Lines Matching refs:ab
8 const ab = new ArrayBuffer(LENGTH); constant
9 const dv = new DataView(ab);
10 const ui = new Uint8Array(ab);
11 const buf = Buffer.from(ab);
16 assert.strictEqual(buf.buffer, ab);
17 assert.strictEqual(buf.length, ab.byteLength);
53 const ab = new Uint8Array(5); constant
54 ab[0] = 1;
55 ab[1] = 2;
56 ab[2] = 3;
57 ab[3] = 4;
58 ab[4] = 5;
59 const buf = Buffer.from(ab.buffer, 1, 3);
65 assert.strictEqual(ab[1], 9);
67 assert.throws(() => Buffer.from(ab.buffer, 6), {
72 assert.throws(() => Buffer.from(ab.buffer, 3, 6), {
81 const ab = new Uint8Array(5); constant
82 ab[0] = 1;
83 ab[1] = 2;
84 ab[2] = 3;
85 ab[3] = 4;
86 ab[4] = 5;
87 const buf = Buffer(ab.buffer, 1, 3);
93 assert.strictEqual(ab[1], 9);
95 assert.throws(() => Buffer(ab.buffer, 6), {
100 assert.throws(() => Buffer(ab.buffer, 3, 6), {
109 const ab = new ArrayBuffer(10); constant
110 const expected = Buffer.from(ab, 0);
111 assert.deepStrictEqual(Buffer.from(ab, 'fhqwhgads'), expected);
112 assert.deepStrictEqual(Buffer.from(ab, NaN), expected);
113 assert.deepStrictEqual(Buffer.from(ab, {}), expected);
114 assert.deepStrictEqual(Buffer.from(ab, []), expected);
117 assert.deepStrictEqual(Buffer.from(ab, [1]), Buffer.from(ab, 1));
121 Buffer.from(ab, Infinity);
131 const ab = new ArrayBuffer(10); constant
132 const expected = Buffer.from(ab, 0, 0);
133 assert.deepStrictEqual(Buffer.from(ab, 0, 'fhqwhgads'), expected);
134 assert.deepStrictEqual(Buffer.from(ab, 0, NaN), expected);
135 assert.deepStrictEqual(Buffer.from(ab, 0, {}), expected);
136 assert.deepStrictEqual(Buffer.from(ab, 0, []), expected);
139 assert.deepStrictEqual(Buffer.from(ab, 0, [1]), Buffer.from(ab, 0, 1));
143 Buffer.from(ab, 0, Infinity);