
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
functional.js
Advanced tools
functional.js is (go on, guess) a functional js library. It facilitates currying and point-free / tacit programming in JavaScript. Minified version here: http://bit.ly/funcmin
functional.js is (go on, guess) a functional js library. It facilitates currying and point-free / tacit programming in JavaScript.
Grab the minified version here.
var concatenate = λ.curry(function(word1, word2) {
return word1 + " " + word2;
});
var concatenateHello = concatenate("Hello");
var result = concatenateHello("World");
expect(result).toEqual("Hello World");
var add = λ.curry(function(arg1, arg2, arg3) {
return arg1 + arg2 + arg3;
});
var add3 = add(3),
add5 = add3(2);
expect(add(3)(2)(1)).toEqual(6);
expect(add3(2, 1)).toEqual(6);
expect(add3(2)(1)).toEqual(6);
expect(add5(1)).toEqual(6);
var add = λ.curry(function(arg1, arg2) {
return arg1 + arg2;
});
var add3 = add(3);
expect(add(1, 2, 3)).toEqual(6);
expect(add3(1, 2, 3, 4, 5)).toEqual(18);
var result = [],
items = ["f", "u", "n", "c"];
var addTo = function (item) {
return result.push(item);
};
var addToResult = λ.each(addTo);
expect(typeof (addToResult)).toEqual("function");
addToResult(items);
expect(result).toEqual(["f", "u", "n", "c"]);
var items = [1, 2, 3];
var doubleUp = function (number) {
return number * 2;
};
var doubleMap = λ.map(doubleUp);
expect(typeof (doubleMap)).toEqual("function");
var result = doubleMap(items);
expect(result).toEqual([2, 4, 6]);
var items = [1, 2, 3];
var multiply = function (arg1, arg2) {
return arg1 * arg2;
};
var multiplyReduceFrom1 = λ.reduce(multiply, 1);
expect(typeof (multiplyReduceFrom1)).toEqual("function");
var result = multiplyReduceFrom1(items);
expect(result).toEqual(6);
var items1 = [1, 2, 3],
items2 = [1, 3, 5];
var even = function (item) {
return item % 2 === 0;
};
var anyEven = λ.any(even);
expect(anyEven(items1)).toBeTruthy();
expect(anyEven(items2)).not.toBeTruthy();
var items = [1, 2, 3, 4, 5];
var even = function (item) {
return item % 2 === 0;
};
var odd = function (item) {
return item % 2 !== 0;
};
var selectEven = λ.select(even);
var selectOdd = λ.select(odd);
expect(selectEven(items)).toEqual([2, 4]);
expect(selectOdd(items)).toEqual([1, 3, 5]);
var e = function (a) {
return "hello " + a;
};
var f = function (a) {
return a + 1;
};
var g = function (a) {
return a * 100;
};
var composed = λ.compose(e, f, g);
expect(composed(2)).toEqual("hello 201");
FAQs
A functional JavaScript library that facilitates currying and point-free programming, with optional lambda expressions.
The npm package functional.js receives a total of 7,085 weekly downloads. As such, functional.js popularity was classified as popular.
We found that functional.js 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.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.