spprt
v1.1.1
Published
Tiny support module for repetitive tasks
Downloads
2
Readme
spprt
Tiny support module for repetitive tasks
Installation
npm install spprt --save
Support
Node 0.10 +
API
last(array)
var spprt = require('spprt');
spprt.last(['a', 'b', 'c']);
//=> 'c'
has(array|object)
var spprt = require('spprt');
spprt.has(['a', 'b', 'c'], 'b');
//=> true
spprt.has({username: ecrmnn}, 'rainbows');
//=> false
inArray(array)
var spprt = require('spprt');
spprt.inArray(['a', 'b', 'c'], 'b');
//=> true
only(object, [properties])
var spprt = require('spprt');
spprt.only({
name: 'Liverpool Football Club',
nickname: 'The Reds',
shortname: 'LFC'
},
['name', 'shortname']
);
//=> {name: 'Liverpool Football Club', shortname: 'LFC'}
except(object, [properties])
var spprt = require('spprt');
spprt.except({
name: 'Liverpool Football Club',
nickname: 'The Reds',
shortname: 'LFC'
},
['name', 'shortname']
);
//=> {nickname: 'The Reds'}
merge(array|object, [values, ...])
var spprt = require('spprt');
spprt.merge([1],[2],[3],[4]);
//=> [1, 2, 3, 4]
spprt.merge({
a: true
}, {
b: false
}, {
a: false
});
//=> {a: true, b: false}
unique(array)
var spprt = require('spprt');
spprt.unique(['rainbows', 'sunshine', 'rainbows']);
//=> ['rainbows', 'sunshine']
shuffle(array)
var spprt = require('spprt');
spprt.shuffle([1, 2, 3, 4, 5, 6, 7, 8]);
//=> [6, 4, 3, 2, 8, 7, 1, 5]
diff(array, [array, ...])
var spprt = require('spprt');
spprt.diff([2, 3, 4], [3, 4, 5]);
//=> [2]
spprt.diff([2, 3, 4], [3, 4, 5], [9, 8, 7, 2]);
//=> []
intersect(array, [array, ...])
var spprt = require('spprt');
spprt.intersect([2, 3, 4], [3, 4, 5]);
//=> [3, 4]
spprt.intersect([2, 3, 4], [3, 4, 5], [9, 8, 7, 2]);
//=> [2, 3, 4]
trim(string)
var spprt = require('spprt');
spprt.trim('just a random string');
//=> 'just a random string'
License
MIT © Daniel Eckermann