MCPcopy Create free account
hub / github.com/formkit/formkit / except

Function except

packages/utils/src/index.ts:538–551  ·  view source on GitHub ↗
(
  obj: Record<string, any>,
  toRemove: Array<string | RegExp>
)

Source from the content-addressed store, hash-verified

536 * @public
537 */
538export function except(
539 obj: Record<string, any>,
540 toRemove: Array<string | RegExp>
541): Record<string, any> {
542 const clean: Record<string, any> = {}
543 const exps = toRemove.filter((n) => n instanceof RegExp) as RegExp[]
544 const keysToRemove = new Set(toRemove)
545 for (const key in obj) {
546 if (!keysToRemove.has(key) && !exps.some((exp) => exp.test(key))) {
547 clean[key] = obj[key]
548 }
549 }
550 return clean
551}
552
553/**
554 * Extracts a set of keys from a given object. Importantly, this will extract

Callers 3

utils.spec.tsFile · 0.90
createInitialPropsFunction · 0.90
useInputFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected