nnmap
1.0.0 • Public • Published nnmap
nnmap
is a function that takes a function and a value, then call the function with the value only if the value is not nil (undefined or null).
Usage
npm install --save nnmap
var nnmap = require('nnmap');
nnmap(function(a) {
return a + 2;
}, 3);
nnmap(function(a) {
return a + 2;
}, undefined);
nnmap(function(a) {
return a + 2;
}, null);
It also supports currying
var nnmap = require('nnmap');
[1,2,undefined, 4, 5].map(nnmap(function(a) {
return a + 2;
}));
Versions
Current Tags
- VersionDownloads (Last 7 Days)
- 1.0.0
106
Version History
- VersionDownloads (Last 7 Days)
- 1.0.0
106
Package Sidebar
Install
Weekly Downloads