Extend nodejs util api, and it is light weight and simple
npm install utils-extend
var util = require('utils-extend');
`
$3
`
npm install utils-extend --save
`
API
$3
Extend api in nodejs util module, $3
Deep clone soure object to target
`js
var target = {};
var source = {
k: 'v',
k2: []
};
var source2 = {
k3: { }
};util.extend(target, source, source2);
`$3
Check target is object, array and function return false.$3
Chck target is array
`
uitl.isArray = Array.isArray`
$3
$3
$3
$3
$3
$3
$3
Empty function$3
Make array unique.
`
var arr = [4, 5, 5, 6];
var result = uitl.unique(arr);
`
$3
Return a copy of the object with list keys
`js
util.pick({ key: 'value' }, 'key');
util.pick({ key: 'value' }, function(value, key, object) { });
`$3
Escapes a string for insertion into HTML, replacing &, <, >, ", , and ' characters.js
var html = ''
var result = util.escape('')
`$3
The opposite of escape$3
Return true is path isabsolute, otherwise return false.
`
util.path.isAbsolute('C:\\file\\path'); // windows
util.path.isAbsolute('/file/path'); // unix
``