Socket
Socket
Sign inDemoInstall

operators

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    operators

JavaScript operators as functions


Version published
Weekly downloads
1.3K
decreased by-10.81%
Maintainers
1
Install size
11.1 kB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 27 Jan 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc