1.0.3 • Published 3 years ago

nv-path-abspls v1.0.3

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

nv-path-abspls

  • nv-path-abspls is very simple util to sort and fullfill absolute-paths

install

  • npm install nv-path-abspls

usage

example

const {fullfill,creat_tree} = require('nv-path-abspls')

var pls = [
   [1, 2, 4],
   [1, 2, 4, 3],
   [1, 3, 6],
   [1, 5 ,2 ,1 ,7],
]
 
> fullfill(pls)
[
  [ 1 ],
  [ 1, 2 ],
  [ 1, 2, 4 ],
  [ 1, 2, 4, 3 ],
  [ 1, 3 ],
  [ 1, 3, 6 ],
  [ 1, 5 ],
  [ 1, 5, 2 ],
  [ 1, 5, 2, 1 ],
  [ 1, 5, 2, 1, 7 ]
]
>   

var t = creat_tree(pls)
> t.$sdfs_repr(r=>"  ".repeat(r.$depth())+r.v)
1
   2
      4
         3
   3
      6
   5
      2
         1
            7

APIS

  • abspls.level_group(pls)
  • abspls.fullfill(pls)
  • abspls.creat_tree(pls)

LICENSE

  • ISC