
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
logical-operators
Advanced tools
A tiny library that abstracts away logical operators with the intention of improving code readability.
A tiny library that abstracts away logical operators with the intention of improving code readability. Ideal for composing complex validation queries.
$ npm install logical-operators --save
const { every } = require('logical-operators')
const is = require('library-that-validate-stuff')
const values = [1, 9, 7,'level', 'Venezuela', 'Caracas', 'Aba', 'hola', 10, undefined, 'USA']
const palindromeCities = every(is.string, is.palindrome, is.city)
values.filter(palindromeCities) // => ['Aba']
values.every(palindromeCities) // => false
values.some(palindromeCities) // => true
const { some } = require('logical-operators')
const between = require('in-between')
const is = require('library-that-validate-stuff')
const values = ['a','b','two', 'd', 'x', 3, undefined, null,'three']
values.every(some(between('w','z'), is.number, between('a','c'))) // => false
values.filter(some(between('w','z'), is.number, between('a','c'))) // => ['b', 3, 'x']
Same as 'some' but only accepts 2 params
const { or } = require('logical-operators')
const is = require('library-that-validate-stuff')
const values = [1,2,'three']
const string_or_number = or(is.string, is.number)
values.every(string_or_number) // => true
values.filter(string_or_number) // => [1, 2, 'three']
Same as 'every' but only accepts 2 params
const { both } = require('logical-operators')
const is = require('library-that-validate-stuff')
const values = ['a','b','two']
const string_and_singleChar = both(is.string, is.singleChar)
values.every(string_and_singleChar) // => false
values.filter(string_and_singleChar) // => ['a','b']
const { equal, greater } = require('logical-operators')
const is = require('library-that-validate-stuff')
const compose = require('lodash/compose')
var getAsciiSum = (str) => str.split('').map(char => char.charCodeAt(0)).reduce((prev, next)=> prev+ next,0)
var values = [1,2,3, 'ab', 'e', 'T', 'W', '/']
values.every(
is.string,
equal(getAsciiSum, compose(greater(102).than, toAscii) ),
) // => false
values.filter(
is.string,
equal(getAsciiSum, compose(greater(100).than, toAscii) ),
) // => ['ab', 'e']
MIT © Alvaro Bernal
FAQs
A tiny library that abstracts away logical operators with the intention of improving code readability.
We found that logical-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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.