@awslabs-community-fork/dynamodb-batch-iterator
Advanced tools
Comparing version 0.7.12 to 0.7.13
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.itemIdentifier = void 0; | ||
const bytes = require('utf8-bytes'); | ||
const convertToBytes = (str) => { | ||
var bytes = []; | ||
for (var i = 0; i < str.length; i++) { | ||
var c = str.charCodeAt(i); | ||
if (c >= 0xd800 && c <= 0xdbff && i + 1 < str.length) { | ||
var cn = str.charCodeAt(i + 1); | ||
if (cn >= 0xdc00 && cn <= 0xdfff) { | ||
var pt = (c - 0xd800) * 0x400 + cn - 0xdc00 + 0x10000; | ||
bytes.push(0xf0 + Math.floor(pt / 64 / 64 / 64), 0x80 + Math.floor(pt / 64 / 64) % 64, 0x80 + Math.floor(pt / 64) % 64, 0x80 + pt % 64); | ||
i += 1; | ||
continue; | ||
} | ||
} | ||
if (c >= 2048) { | ||
bytes.push(0xe0 + Math.floor(c / 64 / 64), 0x80 + Math.floor(c / 64) % 64, 0x80 + c % 64); | ||
} | ||
else if (c >= 128) { | ||
bytes.push(0xc0 + Math.floor(c / 64), 0x80 + c % 64); | ||
} | ||
else | ||
bytes.push(c); | ||
} | ||
return bytes; | ||
}; | ||
/** | ||
@@ -39,3 +62,3 @@ * @internal | ||
if (typeof value === 'string') { | ||
return Uint8Array.from(bytes(value)); | ||
return Uint8Array.from(convertToBytes(value)); | ||
} | ||
@@ -42,0 +65,0 @@ if (isArrayBuffer(value)) { |
@@ -1,2 +0,25 @@ | ||
const bytes = require('utf8-bytes'); | ||
const convertToBytes = (str) => { | ||
var bytes = []; | ||
for (var i = 0; i < str.length; i++) { | ||
var c = str.charCodeAt(i); | ||
if (c >= 0xd800 && c <= 0xdbff && i + 1 < str.length) { | ||
var cn = str.charCodeAt(i + 1); | ||
if (cn >= 0xdc00 && cn <= 0xdfff) { | ||
var pt = (c - 0xd800) * 0x400 + cn - 0xdc00 + 0x10000; | ||
bytes.push(0xf0 + Math.floor(pt / 64 / 64 / 64), 0x80 + Math.floor(pt / 64 / 64) % 64, 0x80 + Math.floor(pt / 64) % 64, 0x80 + pt % 64); | ||
i += 1; | ||
continue; | ||
} | ||
} | ||
if (c >= 2048) { | ||
bytes.push(0xe0 + Math.floor(c / 64 / 64), 0x80 + Math.floor(c / 64) % 64, 0x80 + c % 64); | ||
} | ||
else if (c >= 128) { | ||
bytes.push(0xc0 + Math.floor(c / 64), 0x80 + c % 64); | ||
} | ||
else | ||
bytes.push(c); | ||
} | ||
return bytes; | ||
}; | ||
/** | ||
@@ -35,3 +58,3 @@ * @internal | ||
if (typeof value === 'string') { | ||
return Uint8Array.from(bytes(value)); | ||
return Uint8Array.from(convertToBytes(value)); | ||
} | ||
@@ -38,0 +61,0 @@ if (isArrayBuffer(value)) { |
{ | ||
"name": "@awslabs-community-fork/dynamodb-batch-iterator", | ||
"version": "0.7.12", | ||
"version": "0.7.13", | ||
"description": "Abstraction for DynamoDB batch reads and writes for that handles batch splitting and partial retries with exponential backoff", | ||
@@ -33,4 +33,3 @@ "keywords": [ | ||
"dependencies": { | ||
"tslib": "^2.1.0", | ||
"utf8-bytes": "^0.0.1" | ||
"tslib": "^2.1.0" | ||
}, | ||
@@ -69,3 +68,3 @@ "jest": { | ||
}, | ||
"gitHead": "0c9d3205be36a616d9b59280e7cb874cf2c17624" | ||
"gitHead": "10bc5499c70c6051b746f89c20b6f6d0b991ad4f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
91630
1
1129
- Removedutf8-bytes@^0.0.1
- Removedutf8-bytes@0.0.1(transitive)