1.0.0 • Published 4 years ago

spread-paths v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

spread-paths.js

npm.io

字符串转换,将有使用[]符号合并的path路径展开

安装

npm i -s spread-paths

使用

const spreadPaths = require("spread-paths");


spreadPaths("a.b, c.d.e"); //"a.b,c.d.e"

spreadPaths("a.b[c,e]"); //"a.b.c,a.b.e"

spreadPaths("a.b[c,e[f,g]]"); //"a.b.c,a.b.e.f,a.b.e.g"

注意

spreadPaths({});//报错:必须是字符串
spreadPaths("a[b]]");//报错:方括号未闭合
spreadPaths("a[b,c]e");//报错:不支持分支后再合并写法