nv-path-fatpls

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

Usage no npm install needed!

<script type="module">
  import nvPathFatpls from 'https://cdn.skypack.dev/nv-path-fatpls';
</script>

README

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