New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

nv-json-jshape

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nv-json-jshape

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

latest
npmnpm
Version
1.0.16
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 13 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts