ejson-extras
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "ejson-extras", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Extends EJSON with additional types, including Qty (js-quantities) objects.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,2 +12,19 @@ Extends EJSON with additional types. | ||
# Usage | ||
```javascript | ||
const EJSON = require('ejson'); | ||
require('ejson-extras'); | ||
const map1 = new Map().set('foo', 'bar').set('hello', 'world'); | ||
EJSON.stringify(map1); // '{"$type":"Map","$value":"[[\\"foo\\",\\"bar\\"],[\\"hello\\",\\"world\\"]]"}' | ||
JSON.stringify(map1); // '{}' | ||
const string = '{"$type":"Map","$value":"[[\\"hello\\",\\"world\\"]]"}'; | ||
EJSON.parse(string); // Map { 'hello' => 'world' } | ||
const map2 = new Map().set('hello', 'world').set('foo', 'bar'); | ||
EJSON.equals(map1, map2); // true | ||
``` | ||
# Creating a custom type | ||
@@ -14,0 +31,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
7233
67