Explorar o código

Code refactoring to Model#bind private functions: used Array#every instead of Array#findIndex.

Aleksander Nowodzinski %!s(int64=10) %!d(string=hai) anos
pai
achega
fdca6fbea8
Modificáronse 1 ficheiros con 2 adicións e 4 borrados
  1. 2 4
      packages/ckeditor5-utils/src/model.js

+ 2 - 4
packages/ckeditor5-utils/src/model.js

@@ -363,9 +363,7 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], ( EmitterMixin, C
 	 * @returns {Boolean}
 	 */
 	function hasAttributes( model, attrs ) {
-		return attrs.findIndex( a => {
-			return Object.keys( model._attributes ).indexOf( a ) === -1;
-		} ) == -1;
+		return attrs.every( a => a in model._attributes );
 	}
 
 	/**
@@ -376,7 +374,7 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], ( EmitterMixin, C
 	 * @returns {Boolean}
 	 */
 	function isStringArray( arr ) {
-		return arr.findIndex( a => typeof a !== 'string' ) == -1;
+		return arr.every( a => typeof a == 'string' );
 	}
 
 	/**