@apache-arrow/ts
Advanced tools
Comparing version
{ | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"name": "@apache-arrow/ts", | ||
@@ -4,0 +4,0 @@ "browser": "Arrow.dom.ts", |
@@ -18,3 +18,2 @@ // Licensed to the Apache Software Foundation (ASF) under one | ||
import { toUint8Array } from './buffer'; | ||
import { | ||
@@ -25,26 +24,8 @@ TextDecoder as TextDecoderPolyfill, | ||
/** @ignore @suppress {missingRequire} */ | ||
const _Buffer = eval("typeof Buffer === 'function' ? Buffer : null"); | ||
const decoder = new (typeof TextDecoder !== 'undefined' ? TextDecoder : TextDecoderPolyfill)('utf-8'); | ||
/** @ignore */ | ||
const useNativeEncoders = typeof TextDecoder === 'function' && typeof TextEncoder === 'function'; | ||
export const decodeUtf8 = (buffer?: ArrayBuffer | ArrayBufferView) => decoder.decode(buffer); | ||
const encoder = new (typeof TextEncoder !== 'undefined' ? TextEncoder : TextEncoderPolyfill)(); | ||
/** @ignore */ | ||
export const decodeUtf8 = ((TextDecoder) => { | ||
if (useNativeEncoders || !_Buffer) { | ||
const decoder = new TextDecoder('utf-8'); | ||
return (buffer?: ArrayBuffer | ArrayBufferView) => decoder.decode(buffer); | ||
} | ||
return (input: ArrayBufferLike | ArrayBufferView) => { | ||
const { buffer, byteOffset, length } = toUint8Array(input); | ||
return _Buffer.from(buffer, byteOffset, length).toString(); | ||
}; | ||
})(typeof TextDecoder !== 'undefined' ? TextDecoder : TextDecoderPolyfill); | ||
/** @ignore */ | ||
export const encodeUtf8 = ((TextEncoder) => { | ||
if (useNativeEncoders || !_Buffer) { | ||
const encoder = new TextEncoder(); | ||
return (value?: string) => encoder.encode(value); | ||
} | ||
return (input = '') => toUint8Array(_Buffer.from(input, 'utf8')); | ||
})(typeof TextEncoder !== 'undefined' ? TextEncoder : TextEncoderPolyfill); | ||
export const encodeUtf8 = (value?: string) => encoder.encode(value); |
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 3 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 3 instances in 1 package
0
-100%973427
-0.08%17633
-0.1%