jsurl2
Advanced tools
Comparing version 2.1.1 to 2.2.0
{ | ||
"name": "jsurl2", | ||
"description": "URL friendly JSON-like formatting and parsing", | ||
"version": "2.1.1", | ||
"license": "MIT", | ||
"homepage": "http://github.com/wmertens/jsurl2", | ||
"author": "Wout Mertens", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/wmertens/jsurl2.git" | ||
}, | ||
"main": "lib/jsurl2.js", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"blns": "^2.0.4", | ||
"jest": "^27.0.6", | ||
"jest-cli": "^27.0.6", | ||
"prettier": "^2.3.2" | ||
}, | ||
"files": [ | ||
"lib", | ||
"v1.js" | ||
], | ||
"directories": { | ||
"lib": "./lib" | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"test-watch": "jest --watch", | ||
"format": "prettier -w .", | ||
"release": "npx np" | ||
} | ||
} | ||
"name": "jsurl2", | ||
"version": "2.2.0", | ||
"description": "URL friendly JSON-like formatting and parsing", | ||
"keywords": [ | ||
"json", | ||
"url", | ||
"query", | ||
"stringify", | ||
"parse", | ||
"serialize", | ||
"deserialize" | ||
], | ||
"license": "MIT", | ||
"homepage": "http://github.com/wmertens/jsurl2", | ||
"author": "Wout Mertens", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/wmertens/jsurl2.git" | ||
}, | ||
"main": "dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
} | ||
}, | ||
"packageManager": "pnpm@8.15.5", | ||
"devDependencies": { | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@types/node": "^20.11.30", | ||
"blns": "^2.0.4", | ||
"prettier": "^3.2.5", | ||
"terser": "^5.30.0", | ||
"vite": "^5.2.6", | ||
"vite-plugin-dts": "^3.8.1", | ||
"vitest": "^1.4.0" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "vite build", | ||
"bench": "vitest bench", | ||
"format": "prettier -w .", | ||
"test": "vitest", | ||
"release": "npx np" | ||
} | ||
} |
# JSURL2 | ||
Live demo: https://cv122s.csb.app/ | ||
Live demo: https://wmertens.github.io/jsurl2/ | ||
Live editor: https://cv122s.csb.app/ | ||
@@ -70,3 +71,3 @@ JSURL2 aims to be a drop-in replacement for JSON encoding with better size and time characteristics. | ||
```javascript | ||
var JSURL = require("@yaska-eu/jsurl2"); | ||
var JSURL = require("jsurl2"); | ||
@@ -86,30 +87,2 @@ // Options: | ||
### Upgrading from version 1 | ||
JSURL2 is based in spirit on the JSURL written by Bruno Jouhier (thanks!). It has been | ||
optimized for size and readability. You can start using JSURL2 instead of JSURL by simply | ||
using this package. | ||
Things to note when upgrading: | ||
- Version 2 might need extra URI-encoding depending on your needs | ||
- You can call `parse(text, {deURI: true})` to handle any URI decoding automatically | ||
- Version 1 encoded text is _not_ parseable by v2. You need to check if the string starts with a `~` and if so, use the v1 API as described below. | ||
- The reason this is not automatic is to prevent adding the v1 code to bundles | ||
- Version 1 clients are _not_ able to parse version 2 encoding | ||
### Version 1 | ||
The old v1 API is still available if you need to decode v1 stringifieds. | ||
```javascript | ||
var JSURL1 = require("jsurl2/v1"); | ||
str = JSURL1.stringify(obj); | ||
obj = JSURL1.parse(str); | ||
// return def instead of throwing on error | ||
obj = JSURL1.tryParse(str[, def]); | ||
``` | ||
## Syntax | ||
@@ -116,0 +89,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
42740
8
8
129
123
1