Commit ad07d409 authored by 周远喜's avatar 周远喜

o分组函数

parent 8da409ca
......@@ -96,6 +96,17 @@ henq.getDate = (strDate) => {
}).match(/\d+/g) + ')');
return date;
}
henq.group=(array, f)=> {
const groups = {};
array.forEach(function (o) {
const group = JSON.stringify(f(o));
groups[group] = groups[group] || [];
groups[group].push(o);
});
return Object.keys(groups).map(function (group) {
return groups[group];
});
}
henq.toTree = (list, rootId, format, parentFiledName) => {
var upId = parentFiledName;
let i = 0;
......
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