Skip to content
Myr

input.js

This file

Path

test/helpers/input.js

16 lines · 782 bytes · JavaScript

Last changed by

Fix using both `encoding: 'utf16le'` and `lines`/`verbose` options (#931)ehmickybefore adoptiona480e1d

History of this file

Take it

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

lines 1–4why, one step back
1import {Buffer} from 'node:buffer';
23const textEncoder = new TextEncoder();4

Fix using both `encoding: 'utf16le'` and `lines`/`verbose` options (#931)ehmickybefore adoptiona480e1d

lines 5–6why, one step back
5export const bufferToUint8Array = buffer => new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
6

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

lines 7–11why, one step back
7export const foobarString = 'foobar';
8export const foobarUint8Array = textEncoder.encode('foobar');9export const foobarArrayBuffer = foobarUint8Array.buffer;10export const foobarUint16Array = new Uint16Array(foobarArrayBuffer);11export const foobarBuffer = Buffer.from(foobarString);

Fix using both `encoding: 'utf16le'` and `lines`/`verbose` options (#931)ehmickybefore adoptiona480e1d

lines 12–13why, one step back
12const foobarUtf16Buffer = Buffer.from(foobarString, 'utf16le');
13export const foobarUtf16Uint8Array = bufferToUint8Array(foobarUtf16Buffer);

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

lines 14–16why, one step back
14export const foobarDataView = new DataView(foobarArrayBuffer);
15export const foobarObject = {foo: 'bar'};16export const foobarObjectString = JSON.stringify(foobarObject);