@kingjs/linq.select

1.0.7 • Public • Published

@kingjs/linq.select

Generates a sequence of elements composed of elements of another sequence subject to a transform.

Usage

Lower the case of 'A', 'B', 'C' like this:

var select = require('@kingjs/linq.select');
var sequence = require('@kingjs/enumerable.create');
var toArray = require('@kingjs/linq.to-array');

function selectLowerCase(x) {
  return String.prototype.toLowerCase.call(x);
}

var result = select.call(sequence('A', 'B', 'C'), selectLowerCase);

toArray.call(result);

result:

['a', 'b', 'c']

API

function select(
  this: Enumerable, 
  selector: (x, i) => any
): Enumerable

Interfaces

Parameters

  • this: A sequence of element to transform.
  • selector: A transform applied to each element.
    • x: The element to transform.
    • i: The index of the element being transformed.

Return Value

A transformation of each element of the original sequence.

Install

With npm installed, run

$ npm install @kingjs/link.select

Acknowledgments

Like Enumerable.Select

License

MIT

Analytics

Readme

Keywords

none

Package Sidebar

Install

npm i @kingjs/linq.select

Weekly Downloads

9

Version

1.0.7

License

MIT

Unpacked Size

3.38 kB

Total Files

4

Last publish

Collaborators

  • kingces95