diff --git a/lib/index.js b/lib/index.js index 74e2c9c..d960619 100644 --- a/lib/index.js +++ b/lib/index.js @@ -23,16 +23,16 @@ exports.parseAll = function ( chtml ) { const arr = keys.map( ( key ) => exports.metadataFunctions[ key ]( chtml ) ); let result; // Result in for loop over results - let key; // Key corrsponding to location of result + let key; // Key corresponding to location of result return BBPromise.all( arr.map( ( x ) => x.reflect() ) ) .then( ( results ) => { - for ( const r in results ) { + Object.keys( results ).forEach( function ( r ) { result = results[ r ]; key = keys[ r ]; if ( result && result.isFulfilled() && result.value() ) { meta[ key ] = result.value(); } - } + } ); if ( Object.keys( meta ).length === 0 ) { throw new Error( 'No metadata found in page' ); }