Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Changes Config iterator interface to Config#names() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarwrobel committed Dec 5, 2019
1 parent f9bd16e commit d3e2d35
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' ] );
} );
} );
} );

0 comments on commit d3e2d35

Please sign in to comment.