sequency0.19.2 • Public • Published
Not convinced? Try Sequency right in your browser.
npm install --save sequency
Alternatively use Sequency from CDN by adding this to your HTML:
How Sequency works
Sequences can be created by utilizing one of the following functions:
sequenceOfaccepts one or many values and returns a new sequence.
asSequenceaccepts an iterable (e.g. an array, set or map) and returns a new sequence.
emptySequencereturns a new empty sequence.
rangereturns as number sequence consisting of all numbers between
generateSequencereturns a sequence generated from the given generator function.
extendSequenceallows extending sequences with user-defined operations (see example).
Sequence provides a fluent functional API consisting of intermediate and terminal operations. Intermediate functions (e.g.
sorted) return a new sequence, thus enabling method chaining. Terminal functions (e.g.
findLast) return an arbitrary result. Detailed descriptions of all operations are available in the API docs.
Sequences are lazily evaluated to avoid examining all of the input data when it's not necessary. Sequences always perform the minimal amount of operations to gain results. E.g. in a
filter - map - find sequence both
find are executed just one time before returning the single result.
Sequency is fully documented via inline JSDoc comments. The docs are also available online. When using an IDE like Intellij IDEA or Webstorm the docs are available inline right inside your editor.
MIT © Benjamin Winterberg