Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Functional async flow control library. Turn your asynchronous code into bite-sized synchronous looking functions.
npm install breeze
Node.js / Browserify
var breeze = require('breeze')
breeze(next)
- Initialize breeze flow system, supports initial .then
method..when(check, next)
- When check
is truthy, add next
to the stack.maybe(check, next)
- When check
is truthy, add next
to the stack, sugar for breeze.when
.some(check, next)
- When check
is truthy and no other some
or none
has ran, add to the stack.none(next)
- Whenever no some
have ran, add callback to the stack.then(next)
- Add callback to stack.catch(next)
- Any error caught will terminate stack and be sent here.promise()
- Returns a deferred promise system, allowing for a second .catch
.reset()
- Reset current systemThe next
method passed through breeze has a very small api. It accepts two variants of usage, normal node style
err, arguments...
, and promise, arguments...
.
When a truthy err
is passed the system will halt (no other actions will be taken) and .catch
will be triggered.
When a promise
is passed the system will attach to either the then / catch
methods, or the .then(then, catch)
method style depending on the promise type passed. Whenever the then
is invoked, any arguments
passed along with
the passed promise are placed at the front of the arguments array, and the success arguments will be last.
This allows you to chain multiple promises while still passing values down the chain.
function fetchUserTodos (username) {
// Initialize breeze, fetch a user
var flow = breeze(function (next) {
next(api(token).getUser(username))
})
// Fetch user todos, pass user along the chain
flow.then(function (next, user) {
next(user.getTodos(), user)
})
// Catch bugs before you do your work!
flow.when(function (user, todos) {
return todos.getLength() < 0
}, function (next, user, todos) {
todos.reset()
next(todos.save(), user)
})
// Do whatever else you want
flow.then(function (next, user, todos) {
next(null, user, todos)
})
flow.catch(function (err) {
// handle internal function error should you want
if (err.code === 500) {
console.error('Holy Switch A Roo Batman! I think something really went wrong.')
}
console.error(err)
})
return flow.promise()
}
var promise = fetchUserTodos('nijikokun')
promise.then(function (user, todos) {
// Show todos
})
promise.catch(function (err) {
// Show error in application
})
Check out the examples directory for in-depth examples and tutorials of how to use breeze.
Licensed under The MIT License.
FAQs
Functional async flow control library
The npm package breeze receives a total of 113 weekly downloads. As such, breeze popularity was classified as not popular.
We found that breeze demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.