nv-path-fatpls

1.0.0 • Public • Published

nv-path-fatpls

  • nv-path-fatpls is very simple util to convert pathlist-bundle to genertor-of-path
  • it is used for huge-routes-with-many-duplicate-paths ,if use json ,the json will be too big

install

  • npm install nv-path-fatpls

usage

example

const nvfpls = require('nv-path-fatpls')

var Fatpls = nvfpls.Fatpls

var pls = [1,new Set(['aaa','xxx']),4,new Set(['b0','b1','b2']),8]
//or use Array 
// pls = [1,['aaa','xxx'],4,['b0','b1','b2'],8]
undefined
> pls
[ 1, Set { 'aaa', 'xxx' }, 4, Set { 'b0', 'b1', 'b2' }, 8 ]
>


> var fat = new Fatpls(pls)
> fat.forEach(r=>console.log(r.join('/')))
1/aaa/4/b0/8
1/aaa/4/b1/8
1/aaa/4/b2/8
1/xxx/4/b0/8
1/xxx/4/b1/8
1/xxx/4/b2/8
undefined
>

> Array.from(fat)
[
  [ 1, 'aaa', 4, 'b0', 8 ],
  [ 1, 'aaa', 4, 'b1', 8 ],
  [ 1, 'aaa', 4, 'b2', 8 ],
  [ 1, 'xxx', 4, 'b0', 8 ],
  [ 1, 'xxx', 4, 'b1', 8 ],
  [ 1, 'xxx', 4, 'b2', 8 ]
]
>

APIS

  • nvfpls.gen(pls)
  • nvfpls.fmt(pls)
  • nvfpls.Fatpls

LICENSE

  • ISC

Readme

Keywords

none

Package Sidebar

Install

npm i nv-path-fatpls

Weekly Downloads

3

Version

1.0.0

License

ISC

Unpacked Size

4.84 kB

Total Files

3

Last publish

Collaborators

  • ihgazni2