ordered-binary 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  [![npm version](https://img.shields.io/npm/dw/ordered-binary)](https://www.npmjs.org/package/ordered-binary)
2
2
  [![npm version](https://img.shields.io/npm/v/ordered-binary.svg?style=flat-square)](https://www.npmjs.org/package/ordered-binary)
3
3
  [![license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)
4
- <a href="https://dev.doctorevidence.com/"><img src="./assets/powers-dre.png" width="203" /></a>
5
4
 
6
5
  The ordered-binary package provides a representation of JavaScript primitives, serialized into binary format (NodeJS Buffers or Uint8Arrays), such that the binary values are naturally ordered such that it matches the natural ordering or values. For example, since -2.0321 > -2.04, then `toBufferKey(-2.0321)` will be greater than `toBufferKey(-2.04)` as a binary representation, in left-to-right evaluation. This is particular useful for storing keys as binaries with something like LMDB or LevelDB, to avoid any custom sorting.
7
6
 
package/dist/index.cjs CHANGED
@@ -69,7 +69,7 @@ function writeKey(key, target, position, inSequence) {
69
69
  }
70
70
  } else {
71
71
  if (target.utf8Write)
72
- position += target.utf8Write(key, position, 0xffffffff);
72
+ position += target.utf8Write(key, position, target.byteLength - position);
73
73
  else
74
74
  position += textEncoder.encodeInto(key, target.subarray(position)).written;
75
75
  if (position > target.length - 4)
package/index.js CHANGED
@@ -65,7 +65,7 @@ export function writeKey(key, target, position, inSequence) {
65
65
  }
66
66
  } else {
67
67
  if (target.utf8Write)
68
- position += target.utf8Write(key, position, 0xffffffff)
68
+ position += target.utf8Write(key, position, target.byteLength - position)
69
69
  else
70
70
  position += textEncoder.encodeInto(key, target.subarray(position)).written
71
71
  if (position > target.length - 4)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ordered-binary",
3
3
  "author": "Kris Zyp",
4
- "version": "1.5.2",
4
+ "version": "1.5.3",
5
5
  "description": "Conversion of JavaScript primitives to and from Buffer with binary order matching natural primitive order",
6
6
  "license": "MIT",
7
7
  "repository": {