MCPcopy Create free account
hub / github.com/nodejs/undici / enumToMap

Function enumToMap

lib/llhttp/utils.js:4–12  ·  view source on GitHub ↗
(obj, filter = [], exceptions = [])

Source from the content-addressed store, hash-verified

2Object.defineProperty(exports, "__esModule", { value: true });
3exports.enumToMap = enumToMap;
4function enumToMap(obj, filter = [], exceptions = []) {
5 const emptyFilter = (filter?.length ?? 0) === 0;
6 const emptyExceptions = (exceptions?.length ?? 0) === 0;
7 return Object.fromEntries(Object.entries(obj).filter(([, value]) => {
8 return (typeof value === 'number' &&
9 (emptyFilter || filter.includes(value)) &&
10 (emptyExceptions || !exceptions.includes(value)));
11 }));
12}

Callers

nothing calls this directly

Calls 2

filterMethod · 0.80
entriesMethod · 0.45

Tested by

no test coverage detected