mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-22 02:07:56 +00:00
15 lines
464 B
JavaScript
15 lines
464 B
JavaScript
import util from 'node:util';
|
|
import { extractGlobal } from '@pezkuwi/x-global';
|
|
export { packageInfo } from './packageInfo.js';
|
|
class Fallback {
|
|
#encoder;
|
|
constructor() {
|
|
this.#encoder = new util.TextEncoder();
|
|
}
|
|
// For a Jest 26.0.1 environment, Buffer !== Uint8Array
|
|
encode(value) {
|
|
return Uint8Array.from(this.#encoder.encode(value));
|
|
}
|
|
}
|
|
export const TextEncoder = /*#__PURE__*/ extractGlobal('TextEncoder', Fallback);
|