( data: TransformData, matchedKeys: string[], args: string | string[] | undefined, isHeader: boolean )
| 397 | } |
| 398 | |
| 399 | function 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 | |
| 421 | function toValueList(value: TransformValue, isHeader: boolean): string[] { |
| 422 | if (value === undefined) { |
no test coverage detected