1.0.0 • Published 3 years ago

nv-path-sdfspls v1.0.0

Weekly downloads
2
License
ISC
Repository
-
Last release
3 years ago

nv-path-sdfspls

  • nv-path-sdfspls is very simple util to convert depth-first pathlists to a tree

  • it is used for handle big pathlist-like structure ,such as windows regidit

install

  • npm install nv-path-sdfspls

usage

example

const nvpls = require('nv-path-sdfspls')

var sdfspls = 
[
    [0],
    [0,1],
    [0,2],
    [0,2,1],
    [0,2,4],
    [0,3],
    [0,3,4]
]

var t = nvpls.sdfspls_to_tree(sdfspls)
var sdfs = t.$sdfs()


var plnd = sdfs[4]
> nvpls.get_pl(plnd)
[ 0, 2, 4 ]
> nvpls.get_pl(plnd.$parent())
[ 0, 2 ]
> nvpls.get_pl(plnd.$sdfs_next())
[ 0, 3 ]
> nvpls.get_pl(plnd.$sdfs_prev())
[ 0, 2, 1 ]
>

> plnd.$ances(true).map(nvpls.get_pl).reverse()
[ [ 0 ], [ 0, 2 ], [ 0, 2, 4 ] ]
>

APIS

  • nvpls.sdfspls_to_tree(sdfspls)
  • nvpls.tree_to_sdfspls(t)
  • nvpls.get_pl(nd)

LICENSE

  • ISC