
Security News
The Code You Didn't Write Is Still Yours to Defend
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.
fun with functional programming in js
fp.fst(fn): Returns a function that calls fn with only the first argument passed.
fp.snd(fn): Returns a function that calls fn with only the second argument passed.
fp.thd(fn): Returns a function that calls fn with only the third argument passed.
fp.nthArg(nth, fn): Returns a function that calls fn with only the nth argument passed.
'use strict';
var fp = require('..'),
items = ['foo', 'bar', 'baz'],
_ = require('lodash'),
indentLog = _.partial(console.log, ' ');
console.log();
console.log('Just passing console.log by itself:');
items.forEach(indentLog);
console.log();
console.log('Wrapping console.log in fp.fst to only get the keys:');
items.forEach(fp.fst(indentLog));
console.log();
console.log('Wrapping console.log in fp.snd to only get the values:');
items.forEach(fp.snd(indentLog));
This produces:
$ node example/log.js
Just passing console.log by itself:
foo 0 [ 'foo', 'bar', 'baz' ]
bar 1 [ 'foo', 'bar', 'baz' ]
baz 2 [ 'foo', 'bar', 'baz' ]
Wrapping console.log in fp.fst to only get the keys:
foo
bar
baz
Wrapping console.log in fp.snd to only get the values:
0
1
2
PRs welcome. I don't have a specific direction in mind yet for this package; I just wanted someplace to stick the small functional tools I keep replicating between projects.
FAQs
fun with functional programming
The npm package fp receives a total of 19 weekly downloads. As such, fp popularity was classified as not popular.
We found that fp 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
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.