st-common-core
Version:
小尾巴前端通用核心库
54 lines (53 loc) • 1.21 kB
JavaScript
import { copyDeep as y } from "../../obj/utils/obj-copy-util.js";
const a = ({
origin: p,
props: l = [],
excludeProps: e = [],
propsMap: n = {},
targetPropValMap: s = {},
excludeArrItem: t = () => !1,
sort: o = null,
isCopyEmptyArr: c = !0,
isRemoveObjUndefined: h = !1,
isRemoveArrUndefined: u = !1
}) => {
const i = [];
for (let f of p) {
if (f === void 0) {
if (u) continue;
i.push(f);
}
if (f === null || typeof f == "function")
i.push(f);
else {
if (t(f)) continue;
Array.isArray(f) ? i.push(a({
origin: f,
props: l,
excludeProps: e,
propsMap: n,
targetPropValMap: s,
excludeArrItem: t,
sort: o,
isCopyEmptyArr: c,
isRemoveObjUndefined: h,
isRemoveArrUndefined: u
})) : typeof f == "object" ? i.push(y({
origin: f,
props: l,
excludeProps: e,
propsMap: n,
targetPropValMap: s,
excludeArrItem: t,
sort: o,
isCopyEmptyArr: c,
isRemoveObjUndefined: h,
isRemoveArrUndefined: u
})) : i.push(f);
}
}
return o && i.sort(o), i;
};
export {
a as copyDeep
};