Browse Source

Changes Config iterator interface to Config#names() method.

Oskar Wróbel 6 years ago
parent
commit
bbd53ae4a8

+ 4 - 4
packages/ckeditor5-utils/src/config.js

@@ -114,14 +114,14 @@ export default class Config {
 	}
 
 	/**
-	 * Iterable interface.
-	 *
 	 * Iterates over all top level configuration names.
 	 *
 	 * @returns {Iterable.<String>}
 	 */
-	[ Symbol.iterator ]() {
-		return Object.keys( this._config )[ Symbol.iterator ]();
+	* names() {
+		for ( const name of Object.keys( this._config ) ) {
+			yield name;
+		}
 	}
 
 	/**

+ 3 - 3
packages/ckeditor5-utils/tests/config.js

@@ -460,9 +460,9 @@ describe( 'Config', () => {
 		} );
 	} );
 
-	describe( 'iterator', () => {
-		it( 'should return top level keys of the configuration', () => {
-			expect( Array.from( config ) ).to.be.deep.equal( [ 'creator', 'language', 'resize', 'toolbar', 'options' ] );
+	describe( 'names()', () => {
+		it( 'should return an iterator of top level names of the configuration', () => {
+			expect( Array.from( config.names() ) ).to.be.deep.equal( [ 'creator', 'language', 'resize', 'toolbar', 'options' ] );
 		} );
 	} );
 } );