Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
lift-result
Advanced tools
lift functions so they can handle Results as if they were plain values
lift functions so they can handle results as if they were plain values.
With your favourite package manager:
packin add lift-result
component install jkroso/lift-result
npm install lift-result
then in your app:
var lift = require('lift-result')
var liftCPS = require('lift-result/cps')
var apply = require('lift-result/apply')
var sexpr = require('lift-result/sexpr')
decorate fn
so it can receive promises as arguments. Return
values will be unboxed wherever possible however errors will
be caught and boxed with a promise since this means you don't
have to handle sync and async errors separately.
var Result = require('result')
var add = lift(function(a, b){ return a + b })
add(1, 2) // => 3
add(Result.wrap(1), 2) // => 3
var one = new Result
var answer = add(one, 2) // => new Result
one.write(1)
answer.value // => 3
decorate a node function so it can receive Results as arguments and will return a result rather than take a callback as its last argument.
var fs = require('fs')
var readFile = liftCPS(fs.readFile)
readFile('Readme.md').read(function(buf){
buf // => fs.readFileSync('Readme.md')
})
apply arguments to the last argument
apply(Result.wrap(1), 2, Array) // => [1, 2]
apply rest of args to fn
sexpr(Array, Result.wrap(1), 2) // => [1, 2]
FAQs
lift functions so they can handle Results as if they were plain values
We found that lift-result 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.