map-to-linked

1.1.3 • Public • Published

map-to-linked

from Hash table to linked table

Tip : 4 spaces indentation are required in json file

 
// before : "summary.json" file 
 
{
    "a":{
        "b":{
            "c":1
        }
    },
    "d":{
        "e":2
    }
}
 
 
// after : generator a named "linked.json" file 
 
 
[{
    "id": 1,
    "pid": -1,
    "layer": 1,
    "type": "dir",
    "content": "a"
}, {
    "id": 2,
    "pid": 1,
    "layer": 2,
    "type": "dir",
    "content": "b"
}, {
    "id": 3,
    "pid": 2,
    "layer": 3,
    "type": "file",
    "content": "c:1"
}, {
    "id": 4,
    "pid": -1,
    "layer": 1,
    "type": "dir",
    "content": "d"
}, {
    "id": 5,
    "pid": 4,
    "layer": 2,
    "type": "file",
    "content": "e:2"
}]
 

install

 
npm install -g map-to-linked
 

Usage

 
#1: default look for "summay.json" file as source 
map-to-linked
 
#2: custom 
map-to-linked source=myname.json
 

Readme

Keywords

none

Package Sidebar

Install

npm i map-to-linked

Weekly Downloads

2

Version

1.1.3

License

ISC

Last publish

Collaborators

  • liqiang0335