use faster and more correct 'find' implementation
This commit is contained in:
parent
701af29192
commit
4ff4ccd1d3
@ -25,9 +25,12 @@ define([], function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Util.find = function (map, path) {
|
Util.find = function (map, path) {
|
||||||
return (map && path.reduce(function (p, n) {
|
var l = path.length;
|
||||||
return typeof(p[n]) !== 'undefined' && p[n];
|
for (var i = 0; i < l; i++) {
|
||||||
}, map));
|
if (typeof(map[path[i]]) === 'undefined') { return; }
|
||||||
|
map = map[path[i]];
|
||||||
|
}
|
||||||
|
return map;
|
||||||
};
|
};
|
||||||
|
|
||||||
Util.uid = function () {
|
Util.uid = function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user