This package has been deprecated

Author message:

see @kingjs/array.make-enumerable

@kingjs/make-enumerable

1.0.1 • Public • Published

@kingjs/make-enumerable

Make an array enumerable by adding a getEnumerable method.

Usage

Make an array enumerable like this:

makeEnumerable = require('@kingjs/make-enumerable');
var sequence = makeEnumerable([ 1, 2 ]);

// sequence is still an array...
sequence.push(3); 

// ...that can enumerated!
var enumerator = sequence.getEnumerator();

var result = [];
while (enumerator.moveNext())
  result.push(enumerator.current);
result;

result:

[ 1, 2, 3 ]

API

declare function makeEnumerable(
  array?: Array
): Enumerable

Interfaces

Parameters

  • array: The array to augment with function getEnumerator.

Returns

The array passed as array augmented with a getEnumerable function.

Remarks

Passing null or undefined will return an empty array that is also enumerable.

The array is frozen by the first call to getEnumerator to prevent mutating the array during enumeration.

Install

With npm installed, run

$ npm install @kingjs/make-enumerable

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @kingjs/make-enumerable

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.82 kB

Total Files

4

Last publish

Collaborators

  • kingces95