1.0.0 • Published 8 years ago

operators v1.0.0

Weekly downloads
1,717
License
MIT
Repository
github
Last release
8 years ago

Operators

npm status build status dependency status coverage status

Operators provides the JavaScript operators as functions. It provides a standard, short, and easy to remember interface for addition, multiplication, concatenation, and-ing, or-ing, as well as several two parameter lambdas for non-associative operators, and curried versions of the binary operators for quick creation of the functions that you end up writing for map and filter all the time.

Usage

Use it with qualified imports with the yet unfinished module import syntax or attach it to the short variable of choice. For selling points, here's how it will look with ES7 modules.

import { gt, plus, pow, eq, prepend } from 'operators'
[1,3,2,6,5,4].filter(gt(4));
// [ 6, 5 ]

[1,2,3,4].map(plus(1)); // [ 2, 3, 4, 5 ]

[1,2,3,4].map(pow(2)); // [ 1, 4, 9, 16 ]

[1,2,3,2].filter(eq(2)); // [ 2, 2 ]

[ [1,2], [3,4] ].map(prepend([0])); // [ [ 0, 1, 2 ], [ 0, 3, 4 ] ]

Read the API.

This modules makes is a core part the larger utility library interlude.

License

MIT-Licensed. See LICENSE file for details.

1.0.0

8 years ago

0.1.7

8 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

11 years ago

0.1.3

12 years ago

0.1.2

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago