Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Functional Programming API.
###Status
Formi exposes the Formi
function.
##Formi(function, args...)
Example
// define predicate function
var not = function(val) {
return !val;
};
var or = function() {
return _.some(arguments);
};
Formi(not, true) // ==> false
Formi(or, false, false) // ==> false
Formi(or, false, true, false) // ==> true
##Formi.chain(args...)
Creates a chain for transforming data.
Example
var sum = function() {
return _.reduce(arguments, function(total, num) {
return total + num;
}, 0)
}
var even = function() {
return _.filter(arguments, function(val) {
return val % 2 === 0;
});
}
Formi.chain(1, 2, 3, 4)
.pipe(even)
.pipe(sum)
.value(); // ==> 6
###Formi.chain().pipe(func)
Define function used to transform wrapped data.
###Formi.chain().value();
Return wrapped data
##Formi.compose(funcs...)
Defines a composite function from a series of argument functions.
f(g(h(arg))) === Formi.compose(h, g, f)(arg)
Example
Both of these expamples define the same function.
var sumEven = Formi.compose(even, sum);
var sumEven = function() {
return Formi.chain(arguments)
.pipe(even)
.pipe(sum)
.value();
}
Formi(sumEven, 2, 3, 4, 5); //==> 6
##Formi.map(func)
Defines a function that applies a function to a set of data
Example
var half = Formi.map(function(num) {
return num / 2;
});
half(2) //==> 1
half(3, 4) //==> [1.5, 2]
half([4, 8]) //==> [2, 4]
##Formi.reduce(func, [value])
Defines a function that reduces a set of data using a supplied function. A second argument can be provided to define an initial reduction value.
Example
var sum = Formi.reduce(function(total, num) {
return total + num;
}, 0);
sum(12) //==> 12
sum(3, 4) //==> 7
sum([7, 10]) //==> 17
var even = Formi.reduce(function(arr, num) {
if (num % 2) {
arr.push(num);
}
return arr;
}, []);
even(1) //==> []
even(1, 2, 3, 4) //==> [2, 4]
even([1, 2, 3, 4]) //==> [2, 4]
FAQs
Functional Programming API
We found that formi 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.