This package has been deprecated

Author message:

see @kingjs/enumerable.create

@kingjs/sequence

1.0.5 • Public • Published

@kingjs/sequence

Yield arguments with the Enumerable interface.

Usage

Create an Enumerable to yield the values 1, 2, and 3 like this:

var sequence = require('@kingjs/sequence')

var enumerable = sequence(0, 1, 2);

var enumerator = enumerable.getEnumerator();

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

result;

result:

[0, 1, 2];

API

declare interface Enumerable {
  getEnumerator: () => {
    moveNext: () => boolean,
    current
  }
}  

declare function sequence(...args: any[]): Enumerable

Interfaces

Enumerable: A sequence of values. If moveNext() returns true, then current has been set to the next (or first) value. If moveNext() returns false, then all values have been returned.

Parameters

args: The arguments to yield.

Return Value

An enumerable which returns the arguments as a sequence.

Install

With npm installed, run

$ npm install @kingjs/sequence

License

MIT

Analytics

Readme

Keywords

none

Package Sidebar

Install

npm i @kingjs/sequence

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

3.21 kB

Total Files

4

Last publish

Collaborators

  • kingces95