Commit 3373d8d1 authored by Tristan Cavelier's avatar Tristan Cavelier

improve function performance

parent dd3ceed4
...@@ -168,16 +168,14 @@ exports.util.dictFilter = dictFilter; ...@@ -168,16 +168,14 @@ exports.util.dictFilter = dictFilter;
* @return {Object} The type dict * @return {Object} The type dict
*/ */
function arrayValuesToTypeDict(array) { function arrayValuesToTypeDict(array) {
var i, type, types = {}; var i, l, type_object = {}, type, v;
for (i = 0; i < array.length; i += 1) { for (i = 0, l = array.length; i < l; i += 1) {
type = Array.isArray(array[i]) ? 'array' : typeof array[i]; v = array[i];
if (!types[type]) { type = Array.isArray(v) ? "array" : typeof v;
types[type] = [array[i]]; /*jslint ass: true */
} else { (type_object[type] = type_object[type] || []).push(v);
types[type][types[type].length] = array[i]; }
} return type_object;
}
return types;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment