🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

bare-buffer

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-buffer - npm Package Compare versions

Comparing version

to
3.1.3

60

index.js

@@ -107,3 +107,12 @@ const constants = require('./lib/constants')

return binding.compare(source, target) === 0
return (
binding.compare(
source.buffer,
source.byteOffset,
source.byteLength,
target.buffer,
target.byteOffset,
target.byteLength
) === 0
)
}

@@ -122,25 +131,32 @@

if (arguments.length === 1) return binding.compare(source, target)
if (arguments.length > 1) {
if (targetStart < 0) targetStart = 0
if (targetStart > target.byteLength) targetStart = target.byteLength
if (targetStart < 0) targetStart = 0
if (targetStart > target.byteLength) targetStart = target.byteLength
if (targetEnd < targetStart) targetEnd = targetStart
if (targetEnd > target.byteLength) targetEnd = target.byteLength
if (targetEnd < targetStart) targetEnd = targetStart
if (targetEnd > target.byteLength) targetEnd = target.byteLength
if (sourceStart < 0) sourceStart = 0
if (sourceStart > source.byteLength) sourceStart = source.byteLength
if (sourceStart < 0) sourceStart = 0
if (sourceStart > source.byteLength) sourceStart = source.byteLength
if (sourceEnd < sourceStart) sourceEnd = sourceStart
if (sourceEnd > source.byteLength) sourceEnd = source.byteLength
if (sourceEnd < sourceStart) sourceEnd = sourceStart
if (sourceEnd > source.byteLength) sourceEnd = source.byteLength
if (sourceStart !== 0 || sourceEnd !== source.byteLength) {
source = source.subarray(sourceStart, sourceEnd)
}
if (sourceStart !== 0 || sourceEnd !== source.byteLength) {
source = source.subarray(sourceStart, sourceEnd)
if (targetStart !== 0 || targetEnd !== target.byteLength) {
target = target.subarray(targetStart, targetEnd)
}
}
if (targetStart !== 0 || targetEnd !== target.byteLength) {
target = target.subarray(targetStart, targetEnd)
}
return binding.compare(source, target)
return binding.compare(
source.buffer,
source.byteOffset,
source.byteLength,
target.buffer,
target.byteOffset,
target.byteLength
)
}

@@ -550,2 +566,3 @@

exports.isBuffer = function isBuffer(value) {
if (value instanceof Buffer) return true
if (typeof value !== 'object' || value === null) return false

@@ -596,3 +613,10 @@

exports.compare = function compare(a, b) {
return binding.compare(a, b)
return binding.compare(
a.buffer,
a.byteOffset,
a.byteLength,
b.buffer,
b.byteOffset,
b.byteLength
)
}

@@ -599,0 +623,0 @@

{
"name": "bare-buffer",
"version": "3.1.2",
"version": "3.1.3",
"description": "Native buffers for JavaScript",

@@ -5,0 +5,0 @@ "exports": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet