
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.

npm install spool
spool takes functions like this:
function add(a, b) {
return a + b
}
function sub(a, b) {
return a - b
}
add(sub(add(1, 9), 2), 5) // 13
and lets you call them like this:
import spool from 'spool'
const math = spool({
add,
sub,
})
math(1).add(9).sub(2).add(5).v // 13
That way, you can write pure functions, but call them in an OOP style... for some reason.
spool threads each return value as the first parameter to the next function.
You can also use spoor to thread each return value as the last parameter to the next function.
You can even wrap mori. This is totally something you should do, and it results in a 100% better api:
import mori from 'mori'
import {spoor} from 'spool'
const m = spoor(mori)
m({foo: 1, bar: 2}).toClj().keys().toJs().v // [ 'foo', 'bar' ]
Here is another example:
import spool from 'spool'
client().artists(1).albums(2).tracks(3).get().v
// =>
// { path: ["/api/v1", "artists", 1, "albums", 2, "tracks", 3],
// method: "GET"
// }
const client = spool({
artists,
albums,
tracks,
get,
post,
put,
}, {
path: ['/api/v1'],
})
function albums(r, id) {
return path(r, ['albums', id])
}
function artists(r, id) {
return path(r, ['artists', id])
}
function tracks(r, id) {
return path(r, ['tracks', id])
}
function get(r, id) {
return method(r, 'GET')
}
function post(r, id) {
return method(r, 'POST')
}
function put(r, id) {
return method(r, 'PUT')
}
function method(r, method) {
return merge(r, {method})
}
function path(r, p) {
return nest(r, {path: p})
}
function headers(r, headers) {
return merge(r, {headers})
}
function nest(...rs) {
return {
...merge(...rs),
path: [].concat(...rs.map(r => r.path).filter(p => p)),
}
}
function merge(...rs) {
return rs.reduce((o, r) => {
for (const k in r) o[k] = _merge(o[k], r[k])
return o
}, {})
}
function _merge(a, b) {
if (!a) return b
if (!b) return a
return typeof a === 'object' && typeof b === 'object' ? merge(a, b) : b
}
FAQs
Thread arguments through pure functions.
We found that spool 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.