From d3e2d350e5cc782e6fa8dc8c46c16d44e545c077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Wr=C3=B3bel?= Date: Thu, 5 Dec 2019 14:58:29 +0100 Subject: [PATCH] Changes Config iterator interface to Config#names() method. --- src/config.js | 8 ++++---- tests/config.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/config.js b/src/config.js index fb13b1c..ce7657d 100644 --- a/src/config.js +++ b/src/config.js @@ -114,14 +114,14 @@ export default class Config { } /** - * Iterable interface. - * * Iterates over all top level configuration names. * * @returns {Iterable.} */ - [ Symbol.iterator ]() { - return Object.keys( this._config )[ Symbol.iterator ](); + * names() { + for ( const name of Object.keys( this._config ) ) { + yield name; + } } /** diff --git a/tests/config.js b/tests/config.js index 76ef846..b9c18c6 100644 --- a/tests/config.js +++ b/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' ] ); } ); } ); } );