aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/@exodus/bytes/fallback/encoding.api.js
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-14 14:46:37 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-14 14:46:37 -0800
commitafa87af01c79a9baa539f2992d32154d2a4739bd (patch)
tree92c7416db734270a2fee1d72ee9cc119379ff8e1 /vanilla/node_modules/@exodus/bytes/fallback/encoding.api.js
parent3b927e84d200402281f68181cd4253bc77e5528d (diff)
downloadneko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.gz
neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.bz2
neko-afa87af01c79a9baa539f2992d32154d2a4739bd.zip
task: delete vanilla js prototype\n\n- Removed vanilla/ directory and web/dist/vanilla directory\n- Updated Makefile, Dockerfile, and CI workflow to remove vanilla references\n- Cleaned up web/web.go to remove vanilla embed and routes\n- Verified build and tests pass\n\nCloses NK-2tcnmq
Diffstat (limited to 'vanilla/node_modules/@exodus/bytes/fallback/encoding.api.js')
-rw-r--r--vanilla/node_modules/@exodus/bytes/fallback/encoding.api.js38
1 files changed, 0 insertions, 38 deletions
diff --git a/vanilla/node_modules/@exodus/bytes/fallback/encoding.api.js b/vanilla/node_modules/@exodus/bytes/fallback/encoding.api.js
deleted file mode 100644
index 8dc5243..0000000
--- a/vanilla/node_modules/@exodus/bytes/fallback/encoding.api.js
+++ /dev/null
@@ -1,38 +0,0 @@
-// TODO: make this more strict against Symbol.toStringTag
-// Is not very significant though, anything faking Symbol.toStringTag could as well override
-// prototypes, which is not something we protect against
-
-function isAnyArrayBuffer(x) {
- if (x instanceof ArrayBuffer) return true
- if (globalThis.SharedArrayBuffer && x instanceof SharedArrayBuffer) return true
- if (!x || typeof x.byteLength !== 'number') return false
- const s = Object.prototype.toString.call(x)
- return s === '[object ArrayBuffer]' || s === '[object SharedArrayBuffer]'
-}
-
-export function fromSource(x) {
- if (x instanceof Uint8Array) return x
- if (ArrayBuffer.isView(x)) return new Uint8Array(x.buffer, x.byteOffset, x.byteLength)
- if (isAnyArrayBuffer(x)) {
- if ('detached' in x) return x.detached === true ? new Uint8Array() : new Uint8Array(x)
- // Old engines without .detached, try-catch
- try {
- return new Uint8Array(x)
- } catch {
- return new Uint8Array()
- }
- }
-
- throw new TypeError('Argument must be a SharedArrayBuffer, ArrayBuffer or ArrayBufferView')
-}
-
-// Warning: unlike whatwg-encoding, returns lowercased labels
-// Those are case-insensitive and that's how TextDecoder encoding getter normalizes them
-export function getBOMEncoding(input) {
- const u8 = fromSource(input) // asserts
- if (u8.length >= 3 && u8[0] === 0xef && u8[1] === 0xbb && u8[2] === 0xbf) return 'utf-8'
- if (u8.length < 2) return null
- if (u8[0] === 0xff && u8[1] === 0xfe) return 'utf-16le'
- if (u8[0] === 0xfe && u8[1] === 0xff) return 'utf-16be'
- return null
-}