Files
lan-manager/web/node_modules/@antv/util/esm/group-to-map.js
openclaw 0a5f6a8047 Initial commit: Lan-manager project code
- Go backend (server/)
- Frontend (web/, server/static/)
- Database and deployment files
- Scripts and docs

Co-Authored-By: 狸花猫/Claude-Qwen3.6-Plus 🐾
2026-04-20 00:52:58 +08:00

29 lines
1009 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import isArray from './is-array';
import isFunction from './is-function';
import groupBy from './group-by';
/**
* 将数据分组成 map
* @param data
* @param condition
*/
export default function groupToMap(data, condition) {
if (!condition) {
return {
0: data,
};
}
if (!isFunction(condition)) {
// 如果是字符串,则按照 a*b 风格成数组
var paramscondition_1 = isArray(condition) ? condition : condition.replace(/\s+/g, '').split('*');
condition = function (row) {
var unique = '_'; // 避免出现数字作为Key的情况会进行按照数字的排序
// 根据字段列表的值,拼接成 key
for (var i = 0, l = paramscondition_1.length; i < l; i++) {
unique += row[paramscondition_1[i]] && row[paramscondition_1[i]].toString();
}
return unique;
};
}
return groupBy(data, condition);
}
//# sourceMappingURL=group-to-map.js.map