@kingjs/array.make-enumerable

Makes an array enumerable by adding a `getEnumerable` method.

Stats

StarsIssuesVersionUpdatedCreatedSize
@kingjs/array.make-enumerable
1.0.53 years ago3 years agoMinified + gzip package size for @kingjs/array.make-enumerable in KB

Readme

@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
): Enumerable

Interfaces

  • Enumerable: See @kingjs/enumerable.define.

    Parameters

  • this: The array to augment with function getEnumerator.

    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-enumerable
    

    License

    MIT

Analytics

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.