项目作者: bitorjs

项目描述 :
Bitorjs 前端框架 路由权重分析
高级语言: JavaScript
项目地址: git://github.com/bitorjs/regexp-path-weight.git
创建时间: 2018-11-28T05:48:50Z
项目社区:https://github.com/bitorjs/regexp-path-weight

开源协议:MIT License

下载


regexp-path-weight

对 path-to-regexp 表示的路由 进行权重分析,并给出路由的 权重,可以利用生成的权重进行路由排序问题。避免因手动排序造成的路由混乱且不可控的情况

install

npm i -S regexp-path-weight

e.g.

  1. const weight = require('regexp-path-weight')
  2. let path = "/e/adf:id/f";
  3. console.log(calc(path))
  4. // 输出 11.6661