]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/vim-mode/node_modules/grim/node_modules/emissary/node_modules/es6-weak-map/node_modules/es6-iterator/array.js
885ad0a4fd7870f011e721e88271e39040e58150
3 var setPrototypeOf
= require('es5-ext/object/set-prototype-of')
4 , contains
= require('es5-ext/string/#/contains')
6 , Iterator
= require('./')
8 , defineProperty
= Object
.defineProperty
11 ArrayIterator
= module
.exports = function (arr
, kind
) {
12 if (!(this instanceof ArrayIterator
)) return new ArrayIterator(arr
, kind
);
13 Iterator
.call(this, arr
);
14 if (!kind
) kind
= 'value';
15 else if (contains
.call(kind
, 'key+value')) kind
= 'key+value';
16 else if (contains
.call(kind
, 'key')) kind
= 'key';
18 defineProperty(this, '__kind__', d('', kind
));
20 if (setPrototypeOf
) setPrototypeOf(ArrayIterator
, Iterator
);
22 ArrayIterator
.prototype = Object
.create(Iterator
.prototype, {
23 constructor: d(ArrayIterator
),
24 _resolve: d(function (i
) {
25 if (this.__kind__
=== 'value') return this.__list__
[i
];
26 if (this.__kind__
=== 'key+value') return [i
, this.__list__
[i
]];
29 toString: d(function () { return '[object Array Iterator]'; })