This package has been deprecated

Author message:

see kingjs

@kingjs/array.make-enumerable

1.0.5 • Public • Published

@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

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

Readme

Keywords

none

Package Sidebar

Install

npm i @kingjs/array.make-enumerable

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

3.89 kB

Total Files

4

Last publish

Collaborators

  • kingces95