Comparing version 1.6.6 to 1.6.7
@@ -20,2 +20,3 @@ const ascii = require('./lib/ascii') | ||
case undefined: | ||
case null: | ||
return utf8 | ||
@@ -470,2 +471,70 @@ case 'ucs2': | ||
function writeDoubleBE (buffer, value, offset) { | ||
if (offset === undefined) offset = 0 | ||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength) | ||
view.setFloat64(offset, value, false) | ||
return offset + 8 | ||
} | ||
function writeFloatBE (buffer, value, offset) { | ||
if (offset === undefined) offset = 0 | ||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength) | ||
view.setFloat32(offset, value, false) | ||
return offset + 4 | ||
} | ||
function writeUInt32BE (buffer, value, offset) { | ||
if (offset === undefined) offset = 0 | ||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength) | ||
view.setUint32(offset, value, false) | ||
return offset + 4 | ||
} | ||
function writeInt32BE (buffer, value, offset) { | ||
if (offset === undefined) offset = 0 | ||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength) | ||
view.setInt32(offset, value, false) | ||
return offset + 4 | ||
} | ||
function readDoubleBE (buffer, offset) { | ||
if (offset === undefined) offset = 0 | ||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength) | ||
return view.getFloat64(offset, false) | ||
} | ||
function readFloatBE (buffer, offset) { | ||
if (offset === undefined) offset = 0 | ||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength) | ||
return view.getFloat32(offset, false) | ||
} | ||
function readUInt32BE (buffer, offset) { | ||
if (offset === undefined) offset = 0 | ||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength) | ||
return view.getUint32(offset, false) | ||
} | ||
function readInt32BE (buffer, offset) { | ||
if (offset === undefined) offset = 0 | ||
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength) | ||
return view.getInt32(offset, false) | ||
} | ||
module.exports = exports = { | ||
@@ -500,3 +569,11 @@ isBuffer, | ||
readUInt32LE, | ||
readInt32LE | ||
readInt32LE, | ||
writeDoubleBE, | ||
writeFloatBE, | ||
writeUInt32BE, | ||
writeInt32BE, | ||
readDoubleBE, | ||
readFloatBE, | ||
readUInt32BE, | ||
readInt32BE | ||
} |
43
index.js
@@ -118,2 +118,34 @@ function isBuffer (value) { | ||
function writeDoubleBE (buffer, value, offset) { | ||
return toBuffer(buffer).writeDoubleBE(value, offset) | ||
} | ||
function writeFloatBE (buffer, value, offset) { | ||
return toBuffer(buffer).writeFloatBE(value, offset) | ||
} | ||
function writeUInt32BE (buffer, value, offset) { | ||
return toBuffer(buffer).writeUInt32BE(value, offset) | ||
} | ||
function writeInt32BE (buffer, value, offset) { | ||
return toBuffer(buffer).writeInt32BE(value, offset) | ||
} | ||
function readDoubleBE (buffer, offset) { | ||
return toBuffer(buffer).readDoubleBE(offset) | ||
} | ||
function readFloatBE (buffer, offset) { | ||
return toBuffer(buffer).readFloatBE(offset) | ||
} | ||
function readUInt32BE (buffer, offset) { | ||
return toBuffer(buffer).readUInt32BE(offset) | ||
} | ||
function readInt32BE (buffer, offset) { | ||
return toBuffer(buffer).readInt32BE(offset) | ||
} | ||
module.exports = { | ||
@@ -148,3 +180,12 @@ isBuffer, | ||
readUInt32LE, | ||
readInt32LE | ||
readInt32LE, | ||
writeDoubleBE, | ||
writeFloatBE, | ||
writeUInt32BE, | ||
writeInt32BE, | ||
readDoubleBE, | ||
readFloatBE, | ||
readUInt32BE, | ||
readInt32BE | ||
} |
{ | ||
"name": "b4a", | ||
"version": "1.6.6", | ||
"version": "1.6.7", | ||
"description": "Bridging the gap between buffers and typed arrays", | ||
@@ -28,6 +28,6 @@ "main": "index.js", | ||
"devDependencies": { | ||
"brittle": "^1.3.5", | ||
"nanobench": "^2.1.1", | ||
"standard": "^16.0.3" | ||
"brittle": "^3.5.2", | ||
"nanobench": "^3.0.0", | ||
"standard": "^17.1.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41037
844