1.0.0 • Published 9 years ago

@rdcl/array-transform v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
9 years ago

@rdcl/array-transform

NPM version Build Status Coverage Status

Tools to lazily transform an array.

Installation

npm install @rdcl/array-transform

Usage

const ArrayTransform = require('@rdcl/array-transform')
let res = new ArrayTransform([1, 2, 3, 4, 5])
    .map(x => x + 3)
    .filter(x => x < 7)
    .toArray()

Methods

The following methods are supported:

  • map - Maps a function to every element in the array (lazy).
  • filter - Filters the array (lazy).
  • forEach - Loops over the elements of the result.
  • toArray - Converts the result to an array.
  • reduce/reduceRight - Reduces the result to a single element.
  • some/every - Tests whether some/every element in the result passes a test.

Tests

npm test