@ethersproject/strings
Advanced tools
Comparing version 5.0.0-beta.133 to 5.0.0-beta.134
@@ -1,1 +0,1 @@ | ||
export declare const version = "strings/5.0.0-beta.133"; | ||
export declare const version = "strings/5.0.0-beta.134"; |
@@ -1,1 +0,1 @@ | ||
export const version = "strings/5.0.0-beta.133"; | ||
export const version = "strings/5.0.0-beta.134"; |
@@ -7,3 +7,3 @@ "use strict"; | ||
// Get the bytes | ||
let bytes = toUtf8Bytes(text); | ||
const bytes = toUtf8Bytes(text); | ||
// Check we have room for null-termination | ||
@@ -17,3 +17,3 @@ if (bytes.length > 31) { | ||
export function parseBytes32String(bytes) { | ||
let data = arrayify(bytes); | ||
const data = arrayify(bytes); | ||
// Must be 32 bytes with a null-termination | ||
@@ -20,0 +20,0 @@ if (data.length !== 32) { |
@@ -19,7 +19,7 @@ "use strict"; | ||
bytes = arrayify(bytes); | ||
let result = []; | ||
const result = []; | ||
let i = 0; | ||
// Invalid bytes are ignored | ||
while (i < bytes.length) { | ||
let c = bytes[i++]; | ||
const c = bytes[i++]; | ||
// 0xxx xxxx | ||
@@ -122,3 +122,3 @@ if (c >> 7 === 0) { | ||
for (let i = 0; i < str.length; i++) { | ||
let c = str.charCodeAt(i); | ||
const c = str.charCodeAt(i); | ||
if (c < 0x80) { | ||
@@ -133,3 +133,3 @@ result.push(c); | ||
i++; | ||
let c2 = str.charCodeAt(i); | ||
const c2 = str.charCodeAt(i); | ||
if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) { | ||
@@ -139,7 +139,7 @@ throw new Error("invalid utf-8 string"); | ||
// Surrogate Pair | ||
c = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); | ||
result.push((c >> 18) | 0xf0); | ||
result.push(((c >> 12) & 0x3f) | 0x80); | ||
result.push(((c >> 6) & 0x3f) | 0x80); | ||
result.push((c & 0x3f) | 0x80); | ||
const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); | ||
result.push((pair >> 18) | 0xf0); | ||
result.push(((pair >> 12) & 0x3f) | 0x80); | ||
result.push(((pair >> 6) & 0x3f) | 0x80); | ||
result.push((pair & 0x3f) | 0x80); | ||
} | ||
@@ -156,3 +156,3 @@ else { | ||
function escapeChar(value) { | ||
let hex = ("0000" + value.toString(16)); | ||
const hex = ("0000" + value.toString(16)); | ||
return "\\u" + hex.substring(hex.length - 4); | ||
@@ -159,0 +159,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export declare const version = "strings/5.0.0-beta.133"; | ||
export declare const version = "strings/5.0.0-beta.134"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = "strings/5.0.0-beta.133"; | ||
exports.version = "strings/5.0.0-beta.134"; |
@@ -138,7 +138,7 @@ "use strict"; | ||
// Surrogate Pair | ||
c = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); | ||
result.push((c >> 18) | 0xf0); | ||
result.push(((c >> 12) & 0x3f) | 0x80); | ||
result.push(((c >> 6) & 0x3f) | 0x80); | ||
result.push((c & 0x3f) | 0x80); | ||
var pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); | ||
result.push((pair >> 18) | 0xf0); | ||
result.push(((pair >> 12) & 0x3f) | 0x80); | ||
result.push(((pair >> 6) & 0x3f) | 0x80); | ||
result.push((pair & 0x3f) | 0x80); | ||
} | ||
@@ -145,0 +145,0 @@ else { |
{ | ||
"name": "@ethersproject/strings", | ||
"version": "5.0.0-beta.133", | ||
"version": "5.0.0-beta.134", | ||
"description": "String utility functions.", | ||
@@ -32,3 +32,3 @@ "main": "./lib/index.js", | ||
"ethereum": "donations.ethers.eth", | ||
"tarballHash": "0xc28697c8f04d75e7a563ef5dcceb08044c8143dc938b8b75e4dc90f5a4c92b8d" | ||
"tarballHash": "0x3e86239eb4e439bcbc0006decb0cf701c8430f2d993462b6c8b2a25afa7c88f1" | ||
} |
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
43981