@naverpay/hidash
Version:
improved lodash
30 lines (29 loc) • 796 B
JavaScript
import n from "core-js-pure/features/instance/push.js";
import { isArrayLike as m } from "./internal/array.mjs";
import { baseIteratee as p } from "./internal/baseIteratee.mjs";
import { isNull as u } from "./isNull.mjs";
import { isPlainObject as y } from "./isPlainObject.mjs";
import { isUndefined as b } from "./isUndefined.mjs";
function P(r, o) {
if (u(r) || b(r))
return [];
const i = p(o), e = [];
if (m(r)) {
const s = r, f = r.length;
for (let t = 0; t < f; t++) {
const a = s[t];
i(a, t, r) && n(e).call(e, a);
}
} else if (y(r)) {
for (const s in r)
if (Object.prototype.hasOwnProperty.call(r, s)) {
const f = r, t = f[s];
i(t, s, f) && n(e).call(e, t);
}
}
return e;
}
export {
P as default,
P as filter
};