MultiLoader-Template/node_modules/es-toolkit/dist/compat/util/iteratee.mjs
3944Realms 768f38fc97 feat: 可使用的构建模板
修改了脚本,使其可以推给Maven仓库
2026-05-03 13:02:19 +08:00

29 lines
755 B
JavaScript

import { identity } from '../../function/identity.mjs';
import { property } from '../object/property.mjs';
import { matches } from '../predicate/matches.mjs';
import { matchesProperty } from '../predicate/matchesProperty.mjs';
function iteratee(value) {
if (value == null) {
return identity;
}
switch (typeof value) {
case 'function': {
return value;
}
case 'object': {
if (Array.isArray(value) && value.length === 2) {
return matchesProperty(value[0], value[1]);
}
return matches(value);
}
case 'string':
case 'symbol':
case 'number': {
return property(value);
}
}
}
export { iteratee };