Comparing version 2.1.0 to 2.1.1
@@ -175,3 +175,3 @@ // TODO custom objects, support Set, Map etc | ||
} else { | ||
throw new Error('Cannot decode part ' + [t].concat(a).join('~')) | ||
throw new Error('Cannot decode part ' + a.s.slice(a.i, a.i + 10)) | ||
} | ||
@@ -282,2 +282,3 @@ return out | ||
// Clean up URI encoded string, whitespace | ||
function clean(s) { | ||
@@ -293,13 +294,14 @@ var out = '' | ||
if (i > j) out += s.slice(j, i) | ||
i++ | ||
while (c === 37) { | ||
c = parseInt(s.slice(i, i + 2), 16) | ||
i += 2 | ||
} | ||
if (c > 32) { | ||
// not a control character or space | ||
out += String.fromCharCode(c) | ||
} | ||
j = i | ||
} else if (c <= 32) { | ||
// Deals with Unicode and invalid escape sequences | ||
s = decodeURIComponent(s.slice(i)) | ||
i = j = 0 | ||
} else if ( | ||
c === 32 || | ||
c === 10 || | ||
c === 13 || | ||
c === 0 || | ||
c === 8232 || | ||
c === 8233 | ||
) { | ||
// Ignore whitespace we encode | ||
if (i > j) out += s.slice(j, i) | ||
@@ -306,0 +308,0 @@ i++ |
{ | ||
"name": "jsurl2", | ||
"description": "URL friendly JSON-like formatting and parsing", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"license": "MIT", | ||
@@ -30,4 +30,5 @@ "homepage": "http://github.com/wmertens/jsurl2", | ||
"test-watch": "jest --watch", | ||
"format": "prettier -w ." | ||
"format": "prettier -w .", | ||
"release": "npx np" | ||
} | ||
} |
# JSURL2 | ||
Live demo: https://cv122s.csb.app/ | ||
JSURL2 aims to be a drop-in replacement for JSON encoding with better size and time characteristics. | ||
@@ -59,6 +61,6 @@ | ||
The easiest way to install `jsurl` is with NPM: | ||
The easiest way to [install `jsurl2` is with NPM](https://www.npmjs.com/package/jsurl2): | ||
```sh | ||
npm install jsurl | ||
npm install jsurl2 | ||
``` | ||
@@ -65,0 +67,0 @@ |
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
17895
505
150