MCPcopy Create free account
hub / github.com/vercel/vercel / opDelete

Function opDelete

packages/cli/src/util/dev/transforms.ts:399–419  ·  view source on GitHub ↗
(
  data: TransformData,
  matchedKeys: string[],
  args: string | string[] | undefined,
  isHeader: boolean
)

Source from the content-addressed store, hash-verified

397}
398
399function opDelete(
400 data: TransformData,
401 matchedKeys: string[],
402 args: string | string[] | undefined,
403 isHeader: boolean
404) {
405 if (args == null) {
406 for (const key of matchedKeys) {
407 delete data[key];
408 }
409 return;
410 }
411
412 const patterns = typeof args === 'string' ? [args] : args;
413 for (const key of matchedKeys) {
414 const kept = toValueList(data[key], isHeader).filter(
415 value => !patterns.some(pattern => matchesRule(value, pattern))
416 );
417 setTransformValue(data, key, fromValueList(kept));
418 }
419}
420
421function toValueList(value: TransformValue, isHeader: boolean): string[] {
422 if (value === undefined) {

Callers 1

applyTransformFunction · 0.85

Calls 5

toValueListFunction · 0.85
matchesRuleFunction · 0.85
setTransformValueFunction · 0.85
fromValueListFunction · 0.85
filterMethod · 0.80

Tested by

no test coverage detected