1.0.1 • Published 5 years ago

@kingjs/linq.define v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@kingjs/linq.all

Returns true if all elements of a sequence satisfy a condition.

Usage

Test if all the numbers 0, 1, and 2, are less than 3 like this:

var all = require('@kingjs/linq.all');
var sequence = require('@kingjs/enumerable.create');

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

all.call(enumerable,
  function(o) { return o < 3; }
);

result:

true

API

declare function all(
  this: Enumerable,
  predicate?: (x) => boolean
): boolean

Interfaces

Parameters

  • this: A sequence of values.
  • predicate The predicate values are tested against.

Return Value

Returns true if predicate is true for all values, otherwise, false.

Remarks

Calling all on an empty sequence returns true.

The default predicate returns true for every value.

Install

With npm installed, run

$ npm install @kingjs/linq.all

Acknowledgments

Like Enumerable.All

License

MIT

Analytics