Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ordered-binary

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ordered-binary - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

.nyc_output/5b6bd808-0399-4ee6-9395-344688761dfa.json

35

index.js

@@ -68,3 +68,3 @@ /*

if (target.utf8Write)
position += target.utf8Write(key, position)
position += target.utf8Write(key, position, 0xffffffff)
else

@@ -288,6 +288,6 @@ position += textEncoder.encodeInto(key, target.subarray(position)).written

if (pendingSurrogate) {
byte1 = pendingSurrogate
pendingSurrogate = null
position += 3
return byte1
byte1 = pendingSurrogate
pendingSurrogate = null
position += 3
return byte1
}

@@ -299,6 +299,5 @@ const byte2 = src[position++] & 0x3f

if (unit > 0xffff) {
unit -= 0x10000
unit = 0xdc00 | (unit & 0x3ff)
pendingSurrogate = ((unit >>> 10) & 0x3ff) | 0xd800
position -= 4 // reset so we can return the next part of the surrogate pair
pendingSurrogate = 0xdc00 | (unit & 0x3ff)
unit = (((unit - 0x10000) >>> 10) & 0x3ff) | 0xd800
position -= 4 // reset so we can return the next part of the surrogate pair
}

@@ -311,3 +310,19 @@ return unit

const readString = eval(makeStringBuilder())
const readString =
typeof process !== 'undefined' && process.isBun ? // the eval in bun doesn't properly closure on position, so we
// have to manually update it
(function(reading) {
let { setPosition, getPosition, readString } = reading;
return (source) => {
setPosition(position);
let value = readString(source);
position = getPosition();
return value;
};
})((new Function('fromCharCode', 'let position; let readString = ' + makeStringBuilder() +
';return {' +
'setPosition(p) { position = p },' +
'getPosition() { return position },' +
'readString }'))(fromCharCode)) :
eval(makeStringBuilder())

@@ -314,0 +329,0 @@ export function compareKeys(a, b) {

{
"name": "ordered-binary",
"author": "Kris Zyp",
"version": "1.4.0",
"version": "1.4.1",
"description": "Conversion of JavaScript primitives to and from Buffer with binary order matching natural primitive order",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -49,2 +49,3 @@ import { assert } from 'chai'

assert.strictEqual(fromBufferKey(toBufferKey('\x03test\x01\x00')), '\x03test\x01\x00')
assert.strictEqual(fromBufferKey(toBufferKey('prance 🧚🏻‍♀️🩷')), 'prance 🧚🏻‍♀️🩷')
})

@@ -51,0 +52,0 @@ test('string comparison', () => {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc