Sha256: f64e30895de1d3804bf5cc200bd8f7fd7d4f1fdb117674893ae0de2be81d3e98
Contents?: true
Size: 884 Bytes
Versions: 62
Compression:
Stored size: 884 Bytes
Contents
var B = require('../').Buffer var test = require('tape') if (process.env.OBJECT_IMPL) B.TYPED_ARRAY_SUPPORT = false test('Buffer.isEncoding', function (t) { t.equal(B.isEncoding('HEX'), true) t.equal(B.isEncoding('hex'), true) t.equal(B.isEncoding('bad'), false) t.end() }) test('Buffer.isBuffer', function (t) { t.equal(B.isBuffer(new B('hey', 'utf8')), true) t.equal(B.isBuffer(new B([1, 2, 3], 'utf8')), true) t.equal(B.isBuffer('hey'), false) t.end() }) test('Buffer.toArrayBuffer', function (t) { var data = [1, 2, 3, 4, 5, 6, 7, 8] if (typeof Uint8Array !== 'undefined') { var result = new B(data).toArrayBuffer() var expected = new Uint8Array(data).buffer for (var i = 0; i < expected.byteLength; i++) { t.equal(result[i], expected[i]) } } else { t.pass('No toArrayBuffer() method provided in old browsers') } t.end() })
Version data entries
62 entries across 62 versions & 1 rubygems