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

nv-json-jshape

v1.0.16

Published

nv-json-jshape ======================= - simple version of nvjson

Downloads

24

Readme

nv-json-jshape

  • simple version of nvjson
  • for test class code-generator in nvlang

install

  • npm install nv-json-jshape

usage

  const jshape   = require("nv-json-jshape");

example

shape

    // ignore data-type(to null) , only keep key 

    > var rt = jshape({a:"ssss",b:[1,{k:"v"},3,[true,false,null]]})
    > rt.shape_
    { a: null, b: [ null, { k: null }, null, [ null, null, null ] ] }
    >
    > rt.$children_[0].shape_
    null
    > rt.$children_[0].K
    'a'
    > rt.$children_[1].shape_
    [ null, { k: null }, null, [ null, null, null ] ]
    > rt.$children_[1].K
    'b'
    > rt.$sdfs_.map(nd=>nd.shape_)
    [
      { a: null, b: [ null, [Object], null, [Array] ] },
      null,
      [ null, { k: null }, null, [ null, null, null ] ],
      null,
      { k: null },
      null,
      null,
      [ null, null, null ],
      null,
      null,
      null
    ]
    >

tshape

   n: null                 //null   will   be tanslated  to a <void*> in nvlang 
   S: string               //string will   be translated to a special-structure(similar to std::string just with utf8-support) in nvlang 
   N: number               //number will   be translated to <double>
   B: boolean              //bool   will   be translated to <bool>

   // A and D ONLY appeared IF be treated AS leaf
      A: array                //array  will   be translated to <std::tuple>(nvlang ONLY has list(dynamic length) AND tuple(fixed length)) 
      D: dict                 //dict   will   be translated to <struct>

   // by default, expand all
    > rt.tshape_
    {
      a: 'S',
      b: [ 'N', { k: 'S' }, 'N', [ 'B', 'B', 'n' ] ],
      c: [ { k: 'S' }, [ 'B', 'B', 'n' ] ]
    }
    > 

cshape

   //for generate declaration from data 

            var rt = jshape(
            {
              "a": "ssss",       //0
              "b": [
                1,       //1
                {
                  "k": "v"  //2
                }, //3
                3, //4
                [
                  true, //5
                  false, //6
                  null   //7
                ] //8
              ], //9
              c: [
                  {
                      k:"vvv" //10
                  },//11
                  [
                      false,//12
                      true, //13
                      null  //14
                  ] //15
              ] //16
            } //17
            )

            > rt.cshape_
            [
              [ 3, { k: 'S' } ],
              [ 8, [ 'B', 'B', 'n' ] ],
              [ 9, [ 'N', 3, 'N', 8 ] ],
              [ 16, [ 3, 8 ] ],
              [ 17, { a: 'S', b: 9, c: 16 } ]
            ]
            >

METHODS

APIS

LICENSE

  • ISC