Socket
Socket
Sign inDemoInstall

jsurl2

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.1 to 2.2.0

dist/index.d.ts

82

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc