Authored by 陈峰

commit

const _ = require('lodash');
const fp = require('lodash/fp');
const splits = ['**', '$$', '::'];
const flow = fp.map(fp.fromPairs);
const resolveStr = (str, level = 0) => {
let sp = [];
const tp = _.split(str, splits[level]);
_.each(tp, child => {
if (child.indexOf(splits[level + 1]) >= 0) {
sp.push(resolveStr(child, level + 1));
}
})
return sp.length ? sp : tp;
}
const parse = (str) => {
return fp.pipe(resolveStr, flow)(str)
}
module.exports = {
parse
};
... ...
const queryParse = require('../lib/query-parse');
module.exports = (req, res, next) => {
if (!req.query.l) {
return res.send();
}
const report = queryParse.parse(req.query.l);
res.json(report)
};
... ...
{
"dependencies": {
"express": "^4.15.4",
"lodash": "^4.17.4",
"yoho-node-lib": "^0.4.2"
},
"name": "yoho-apm",
... ...