diff --git a/src/config.js b/src/config.js index ecad1b0..ce7657d 100644 --- a/src/config.js +++ b/src/config.js @@ -113,6 +113,17 @@ export default class Config { return this._getFromSource( this._config, name ); } + /** + * Iterates over all top level configuration names. + * + * @returns {Iterable.} + */ + * names() { + for ( const name of Object.keys( this._config ) ) { + yield name; + } + } + /** * Saves passed configuration to the specified target (nested object). * diff --git a/tests/config.js b/tests/config.js index 5b3f0c9..b9c18c6 100644 --- a/tests/config.js +++ b/tests/config.js @@ -459,4 +459,10 @@ describe( 'Config', () => { expect( nodesAgain ).to.deep.equal( nodes ); } ); } ); + + 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' ] ); + } ); + } ); } );