Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 

README.md

lon

lon is another json that supports:

  • array holes
  • circular references
  • NaN, Infinity, -Infinity
  • distinguish undefined from null
  • distinguish -0 from 0

install

npm install lon

usage

var LON = require('lon');
var a = [{foo: 'bar'}, undefined, null, 0, -0, ,];
a.push(a);

console.log(LON.stringify(a)); // '[1,u,n,4,5,,0,],{2:3},"foo","bar",0,-0'

require('assert').deepStrictEqual(a, LON.parse(LON.stringify(a))); // ok

class instance

var assert = require('assert');
var LON = require('lon');

function A(a, b) {
    this.a = a;
    this.b = b;
    this.c = this;
}

var a = new A(1, 2);

var str = LON.stringify(a, {A: A}); // 'A{1:2,3:4,5:0},"a",1,"b",2,"c"'
var obj = LON.parse(str, {A: A});

assert(obj instanceof A); // ok
assert.equal(obj.a, 1); // ok
assert.equal(obj.b, 2); // ok
assert.deepStrictEqual(a, obj); // ok

license

distributed under the zlib license

About

loopable notation

Resources

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.