diff options
author | Jelle Licht <[email protected]> | 2025-01-05 18:57:21 +0100 |
---|---|---|
committer | Jelle Licht <[email protected]> | 2025-02-11 14:02:51 +0100 |
commit | 1bb7866667ebc7a0ffd733c598a2723a47ccfb9e (patch) | |
tree | e6e40f9d723639e0e436682c0b39095c14f8479c /gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch | |
parent | 0a5d8258766690fab7ddd2800ddb34fc8b6549d0 (diff) |
gnu: llhttp-bootstrap: Update to 9.2.1.
* gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Register patch.
* gnu/packages/node.scm (llhttp-bootstrap): Update to 9.2.1.
[source]: Use patch.
Diffstat (limited to 'gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch')
-rw-r--r-- | gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch b/gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch new file mode 100644 index 0000000000..16ac6b45f6 --- /dev/null +++ b/gnu/packages/patches/llhttp-ponyfill-object-fromentries.patch @@ -0,0 +1,46 @@ +diff --git a/src/llhttp/constants.ts b/src/llhttp/constants.ts +index 226342e..1a4c93a 100644 +--- a/src/llhttp/constants.ts ++++ b/src/llhttp/constants.ts +@@ -1,4 +1,4 @@ +-import { enumToMap } from './utils'; ++import { enumToMap, fromEntries } from './utils'; + + export type IntDict = Record<string, number>; + +@@ -328,7 +328,7 @@ export const METHODS_RTSP = [ + + export const METHOD_MAP = enumToMap(METHODS); + +-export const H_METHOD_MAP = Object.fromEntries( ++export const H_METHOD_MAP = fromEntries( + Object.entries(METHODS).filter(([ k ]) => k.startsWith('H')) + ); + +diff --git a/src/llhttp/utils.ts b/src/llhttp/utils.ts +index 2251125..5ac4aeb 100644 +--- a/src/llhttp/utils.ts ++++ b/src/llhttp/utils.ts +@@ -1,5 +1,13 @@ + import { IntDict } from './constants'; + ++/*! fromentries. MIT License. Copyright (c) 2018-2020 Feross Aboukhadijeh */ ++export function fromEntries (iterable) { ++ return [...iterable].reduce((obj, [key, val]) => { ++ obj[key] = val ++ return obj ++ }, {}) ++} ++ + export function enumToMap( + obj: IntDict, + filter: ReadonlyArray<number> = [], +@@ -8,7 +16,7 @@ export function enumToMap( + const emptyFilter = (filter?.length ?? 0) === 0; + const emptyExceptions = (exceptions?.length ?? 0) === 0; + +- return Object.fromEntries(Object.entries(obj).filter(([ , value ]) => { ++ return fromEntries(Object.entries(obj).filter(([ , value ]) => { + return ( + typeof value === 'number' && + (emptyFilter || filter.includes(value)) &&
\ No newline at end of file |