1.0.5 • Published 7 years ago
@kingjs/array.make-enumerable v1.0.5
@kingjs/array.make-enumerable
Makes an array enumerable by adding a getEnumerable method.
Usage
Make an array enumerable like this:
var makeEnumerable = require('@kingjs/array.make-enumerable');
var array = makeEnumerable.call([ 1, 2 ]);
// array is an Array...
array.push(3);
// ...that can also be enumerated...
var enumerator = array.getEnumerator();
// ...at the cost of becoming frozen.
// sequence.push(4);
var result = [];
while (enumerator.moveNext())
result.push(enumerator.current);
result;result:
[ 1, 2, 3 ]API
declare function makeEnumerable(
this: Array
): EnumerableInterfaces
Enumerable: See @kingjs/enumerable.define.
Parameters
this: The array to augment with functiongetEnumerator.
Returns
Returns this after adding a getEnumerable function.
Remarks
The array is frozen by the first call to getEnumerator.
Install
With npm installed, run
$ npm install @kingjs/array.make-enumerableLicense
MIT