2016-10-10 03:43:44 +02:00
|
|
|
'use strict';
|
|
|
|
// 26.1.5 Reflect.enumerate(target)
|
2017-05-27 17:36:13 +02:00
|
|
|
var $export = require('./_export')
|
|
|
|
, anObject = require('./_an-object');
|
2016-10-10 03:43:44 +02:00
|
|
|
var Enumerate = function(iterated){
|
|
|
|
this._t = anObject(iterated); // target
|
|
|
|
this._i = 0; // next index
|
|
|
|
var keys = this._k = [] // keys
|
|
|
|
, key;
|
|
|
|
for(key in iterated)keys.push(key);
|
|
|
|
};
|
2017-05-27 17:36:13 +02:00
|
|
|
require('./_iter-create')(Enumerate, 'Object', function(){
|
2016-10-10 03:43:44 +02:00
|
|
|
var that = this
|
|
|
|
, keys = that._k
|
|
|
|
, key;
|
|
|
|
do {
|
|
|
|
if(that._i >= keys.length)return {value: undefined, done: true};
|
|
|
|
} while(!((key = keys[that._i++]) in that._t));
|
|
|
|
return {value: key, done: false};
|
|
|
|
});
|
|
|
|
|
|
|
|
$export($export.S, 'Reflect', {
|
|
|
|
enumerate: function enumerate(target){
|
|
|
|
return new Enumerate(target);
|
|
|
|
}
|
|
|
|
});
|