npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nvlson

v1.0.4

Published

nvlson ======================= - another json, its a simple version of nvison - full-support : true | false | js-number | js-string | bigint | regexp | date | array-buffer(treat--as-leaf) | array(container) | dict(container) - full-support : NaN

Downloads

4

Readme

nvlson

  • another json, its a simple version of nvison

  • full-support : true | false | js-number | js-string | bigint | regexp | date | array-buffer(treat--as-leaf) | array(container) | dict(container)

  • full-support : NaN | +Infinity | -Infinity

  • partly-support: symbol(USE Symbol.for to parse)

  • partly-support: undefined( in array whill be a empty-slot【which not work for forEach AND .map】, in dict will disappear)

  • not-support : circular-reference

  • not-support : multi-key

  • not-support : comments

  • not-support : user-defined-seperator/comma/colon

  • not-support : loose-scientific-number

  • its slow, coz it USE JSON.stringify/JSON.parse replacer directly, that is slow

  • its for test lson-data-structure in nvlang , normally useless

  • its about 8 times SLOW than JSON.stringify/JSON.parse

install

  • npm install nvlson

usage

  const { parse,stringify }   = require("nvlson");

example

        var x = require("nvlson")
        var y  = Symbol.for("sym");
        var ab = v8.serialize("\x00\x01abcdefg\xfe\xff").buffer; 
        /*
        ArrayBuffer {
          [Uint8Contents]: <ff 0d 22 0b 00 01 61 62 63 64 65 66 67 fe ff>,
          byteLength: 15
        }
        */

        var j = [undefined,null,true,false,NaN,+Infinity,-Infinity,11.11,"string",y,new Date,/[a-z]+/i, 12345678901234567890n,ab];

        var s = x.stringify(j,2);

        /*

        [
          "u",
          "n",
          "t",
          "f",
          " ",
          "+",
          "-",
          "N¸\u001e
        ëQ8&@",
          "Sstring",
          "Ysym",
          "D\u0000 O
        qxB",
          "R[\"[a-z]+\",\"i\"]",
          "B12345678901234567890",
          "Aÿ\r\"\u000b\u0000\u0001abcdefgþÿ"
        ]
        */

        > x.parse(s)
        /*
        [
          <1 empty item>,
          null,
          true,
          false,
          NaN,
          Infinity,
          -Infinity,
          11.11,
          'string',
          Symbol(sym),
          2023-03-25T11:02:23.584Z,
          /[a-z]+/i,
          12345678901234567890n,
          ArrayBuffer {
            [Uint8Contents]: <ff 0d 22 0b 00 01 61 62 63 64 65 66 67 fe ff>,
            byteLength: 15
          }
        ]
        > 
        */

        var j = {
            ary: [
                undefined,
                {
                    nu:null,
                    t:true,
                    f:false
                },
                NaN,
                [
                    new Date,
                    "sssssssssssssssssssssssssssssssssssssssssssssss",
                    Symbol.for("sym-using-for"),
                ]
            ],
            dict: {
                un: undefined,
                infi: [+Infinity,-Infinity],
                numlike: {
                    f64: [11.11,0,22e8,-11.11],
                    bi: [-1n,0n,123456789123456789123456789n],
                    ab: v8.serialize("\x00\x01abcdefg\xfe\xff").buffer
                }
            }
        }

        var s = x.stringify(j,2)

        /*
        {
          "ary": [
            "u",
            {
              "nu": "n",
              "t": "t",
              "f": "f"
            },
            " ",
            [
              "D\u0000p¦pqxB",
              "Ssssssssssssssssssssssssssssssssssssssssssssssss",
              "Ysym-using-for"
            ]
          ],
          "dict": {
            "un": "u",
            "infi": [
              "+",
              "-"
            ],
            "numlike": {
              "f64": [
                "N¸\u001e
        ëQ8&@",
                "N\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
                "N\u0000\u0000\u0000À*dàA",
                "N¸\u001e
        ëQ8&À"
              ],
              "bi": [
                "B-1",
                "B0",
                "B123456789123456789123456789"
              ],
              "ab": "Aÿ\r\"\u000b\u0000\u0001abcdefgþÿ"
            }
          }
        }
        */

         x.parse(s)
        /*
        >  x.parse(s)
        {
          ary: [
            <1 empty item>,                                // undefined become empty slot 
            { nu: null, t: true, f: false },
            NaN,
            [
              2023-03-25T11:11:07.367Z,
              'sssssssssssssssssssssssssssssssssssssssssssssss',
              Symbol(sym-using-for)
            ]
          ],
          dict: {
                                                                          //undefined disappeared
            infi: [ Infinity, -Infinity ],
            numlike: { f64: [Array], bi: [Array], ab: [ArrayBuffer] }
          }
        }
        > 
        */

        /*
        > for(let e of a) {console.log(e)}
        undefined                                            //work 
        { nu: null, t: true, f: false }
        NaN
        [
          2023-03-25T11:11:07.367Z,
          'sssssssssssssssssssssssssssssssssssssssssssssss',
          Symbol(sym-using-for)
        ]

        > a.forEach((r,i)=>console.log(r,i))           
                                                     // empty-slot cant be forEach OR Map
        { nu: null, t: true, f: false } 1
        NaN 2
        [
          2023-03-25T11:11:07.367Z,
          'sssssssssssssssssssssssssssssssssssssssssssssss',
          Symbol(sym-using-for)
        ] 3

        */

speed test

        var jlson = {
            ary: [
                undefined,
                {
                    nu:null,
                    t:true,
                    f:false
                },
                NaN,
                [
                    new Date,
                    "sssssssssssssssssssssssssssssssssssssssssssssss",
                    Symbol.for("sym-using-for"),
                ]
            ],
            dict: {
                un: undefined,
                infi: [+Infinity,-Infinity],
                numlike: {
                    f64: [11.11,0,22e8,-11.11],
                    bi: [-1n,0n,123456789123456789123456789n],
                    ab: v8.serialize("\x00\x01abcdefg\xfe\xff").buffer
                }
            }
        }


        var jjson = {
            ary: [
                undefined,
                {
                    nu:null,
                    t:true,
                    f:false
                },
                -0,
                [
                    new Date,
                    "sssssssssssssssssssssssssssssssssssssssssssssss",
                    "sym-using-for",
                ]
            ],
            dict: {
                un: undefined,
                infi: [Number.MAX_VALUE,-Number.MAX_VALUE],
                numlike: {
                    f64: [11.11,0,22e8,-11.11],
                    bi: [-1,0,1.2345678912345679e+26],
                    ab: v8.serialize("\x00\x01abcdefg\xfe\xff").toString("latin1")
                }
            }
        }


            > sync(100000,(j)=>JSON.stringify(j),jjson)
            {
              rounds: 100000,
              f: [Function (anonymous)],
              costed: 411.23624181747437
            }
            >

            > sync(100000,(j)=>x.stringify(j),jlson)                   //7 times slow than JSON.stringify
            {
              rounds: 100000,
              f: [Function (anonymous)],
              costed: 2852.3511419296265
            }
            >

            var sjson =JSON.stringify(jjson);
            var slson = x.stringify(jlson);


            >sync(100000,(s)=>JSON.parse(s),sjson);
            {
              rounds: 100000,
              f: [Function (anonymous)],
              costed: 265.8316650390625
            }
            >

            > sync(100000,(s)=>x.parse(s),slson);                         // 8 times slow than JSON.parse
            {
              rounds: 100000,
              f: [Function (anonymous)],
              costed: 1864.9141840934753
            }
            >

METHODS

APIS

    {
      T2NM: {
        u: 'undefined',
        n: 'null',
        t: 'true',
        f: 'false',
        ' ': 'NaN',
        '+': '+Infinity',
        '-': '-Infinity',
        N: 'number',
        S: 'string',
        B: 'bigint',
        Y: 'symbol',
        R: 'RegExp',
        D: 'Date',
        A: 'ArrayBuffer'
      },
      encd_rgx: [Function: encd_rgx],
      decd_rgx: [Function: decd_rgx],
      encd_num: [Function: encd_num],
      decd_num: [Function: decd_num],
      encd_dt: [Function: encd_dt],
      decd_dt: [Function: decd_dt],
      can_be_stringify_to_lson
      stringify: [Function: stringify],
      
      parse: [Function: parse]
    }

LICENSE

  • ISC