Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
operators
Advanced tools
Readme
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.
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.
MIT-Licensed. See LICENSE file for details.
FAQs
JavaScript operators as functions
The npm package operators receives a total of 1,121 weekly downloads. As such, operators popularity was classified as popular.
We found that operators demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.