Strips null, undefined, "", empty arrays and empty plain objects from
an object's own properties. Booleans and numbers are always kept, even
false and 0.
Unifies two hand-rolled duplicates found in the audit: ama-deep's
cleanseObject (set matching keys to undefined instead of removing them,
and didn't handle null/""/empty objects) and
bws-checkout-service-spa's removeEmptyProperties (already lodash-based
and behaviorally what this function does - its &&/|| condition is kept
equivalent here, just written left-to-right instead of relying on
operator-precedence to combine the boolean/number carve-out with the rest).
Imports each function from its own submodule (lodash/pickBy,
lodash/isEmpty), not import { pickBy, isEmpty } from "lodash" - lodash
attaches its methods via a mixin pattern that Node's static CJS-named-export
interop can't detect, so that form crashes at load time for a real
(published, prebuilt) consumer, even though it looks fine under Vitest's
more permissive esbuild-based transform. Found the hard way: it broke
pg-frontend-vue the moment it tried to import anything from this package.
Strips
null,undefined,"", empty arrays and empty plain objects from an object's own properties. Booleans and numbers are always kept, evenfalseand0.Unifies two hand-rolled duplicates found in the audit:
ama-deep'scleanseObject(set matching keys toundefinedinstead of removing them, and didn't handlenull/""/empty objects) andbws-checkout-service-spa'sremoveEmptyProperties(already lodash-based and behaviorally what this function does - its&&/||condition is kept equivalent here, just written left-to-right instead of relying on operator-precedence to combine the boolean/number carve-out with the rest).Imports each function from its own submodule (
lodash/pickBy,lodash/isEmpty), notimport { pickBy, isEmpty } from "lodash"- lodash attaches its methods via a mixin pattern that Node's static CJS-named-export interop can't detect, so that form crashes at load time for a real (published, prebuilt) consumer, even though it looks fine under Vitest's more permissive esbuild-based transform. Found the hard way: it brokepg-frontend-vuethe moment it tried to import anything from this package.