updated by GasGit automation
This commit is contained in:
parent
72a2d3e10c
commit
3d7019bd40
1 changed files with 22 additions and 1 deletions
|
@ -12,7 +12,28 @@ var Utils = (function(ns) {
|
||||||
catch(err) {
|
catch(err) {
|
||||||
return 'Error:' + e + '\n' + err.stack.split('\n').slice(1).join('\n');
|
return 'Error:' + e + '\n' + err.stack.split('\n').slice(1).join('\n');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get an array of unique values
|
||||||
|
* @param {[*]} a the array
|
||||||
|
* @param {function} [func] return true if two items are equal
|
||||||
|
* @return {[*]} the unique items
|
||||||
|
*/
|
||||||
|
ns.unique = function (a,func) {
|
||||||
|
return a.filter (function (d) {
|
||||||
|
return a.reduce (function (p,c) {
|
||||||
|
if ((func && func (d,c)) || (!func && d===c)) {
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
},0) === 1;
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
ns.isSameAs = function (a,b) {
|
||||||
|
return ns.keyDigest (a) === ns.keyDigest(b);
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @param {[*]} arguments unspecified number and type of args
|
* @param {[*]} arguments unspecified number and type of args
|
||||||
* @return {string} a digest of the arguments to use as a key
|
* @return {string} a digest of the arguments to use as a key
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue