Skip to content

armgit / pdfcn

Public Imported from GitHub
0

Beautiful pdf components, built on Takumi and Forme. 100% Free, Zero config, one command setup.

fix: handle undefined from codePointAt

Aniket-5087b8aca4a65da
diff --git a/lib/highlight-code.ts b/lib/highlight-code.ts
index 7bef1fa..6326129 100644
--- a/lib/highlight-code.ts
+++ b/lib/highlight-code.ts
@@ -10,7 +10,7 @@ const highlightCache = new LRUCache<string, string>({
const hash = (input: string) => {
let h = 0;
for (let i = 0; i < input.length; i += 1) {
- h = Math.trunc(Math.imul(31, h) + input.codePointAt(i));
+ h = Math.trunc(Math.imul(31, h) + (input.codePointAt(i) ?? 0));
}
return h.toString(36);
};