Package Exports
- devalue
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (devalue) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
devalue
Like JSON.stringify
, but handles
- cyclical references (
obj.self = obj
) - repeated references (
[value, value]
) undefined
,Infinity
,NaN
,-0
- regular expressions
- dates
Map
andSet
Goals:
- Performance
- Compact output
Non-goals:
- Human-readable output
- Stringifying functions or non-POJOs
Usage
import devalue from 'devalue';
let obj = { a: 1, b: 2 };
obj.c = 3;
devalue(obj); // '{a:1,b:2,c:3}'
obj.self = obj;
devalue(obj); // '(function(a){a.a=1;a.b=2;a.c=3;a.self=a;return a}({}))'
If devalue
encounters a function or a non-POJO, it will throw an error.