Socket
Socket
Sign inDemoInstall

canonicalize

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    canonicalize

JSON canonicalize function


Version published
Weekly downloads
217K
decreased by-0.97%
Maintainers
1
Install size
22.2 kB
Created
Weekly downloads
 

Readme

Source

Build Status Coverage Status

canonicalize

JSON canonicalize function. Creates crypto safe predictable canocalization of JSON as defined by RFC8785

Usage

Normal Example

const canonicalize = require('canonicalize');
const  json = {
	"from_account": "543 232 625-3",
	"to_account": "321 567 636-4",
	"amount": 500,
	"currency": "USD"
}
console.log(canonicalize(json));
// output: {"amount":500,"currency":"USD","from_account":"543 232 625-3","to_account":"321 567 636-4"}

Crazy Example

const canonicalize = require('canonicalize');
const  json = {
	"1": {"f": {"f":  "hi","F":  5} ,"\n":  56.0},
	"10": { },
	"":  "empty",
	"a": { },
	"111": [ {"e":  "yes","E":  "no" } ],
	"A": { }
}
console.log(canonicalize(json));
// output: {"":"empty","1":{"\n":56,"f":{"F":5,"f":"hi"}},"10":{},"111":[{"E":"no","e":"yes"}],"A":{},"a":{}}

Install

npm install canonicalize --save

Test

npm test

Keywords

FAQs

Last updated on 02 Apr 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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