chore: 更新Npm shrinkwrap

This commit is contained in:
sean 2017-09-03 10:08:39 +08:00
parent 72397a2802
commit 7de76b5bf9
4 changed files with 7315 additions and 5782 deletions

View File

@ -3,65 +3,65 @@ var varSplit = '.';
var mockSplit = '|';
function mock(mockJSON, context) {
context = context || {};
var filtersMap = {
regexp: handleRegexp
};
context = context || {};
var filtersMap = {
regexp: handleRegexp
};
return parse(mockJSON);
return parse(mockJSON);
function parse(p, c) {
c = c || {};
for (var i in p) {
if (!p.hasOwnProperty(i)) {
continue;
}
if (typeof p[i] === 'object') {
c[i] = (p[i].constructor === Array) ? [] : {};
parse(p[i], c[i]);
} else {
p[i] = handleStr(p[i]);
var filters = i.split(mockSplit), newFilters = [].concat(filters);
c[i] = p[i];
if (filters.length > 1) {
for (var f = 1, l = filters.length, index; f < l; f++) {
if (filters[f] in filtersMap) {
if ((index = newFilters.indexOf(filters[f])) !== -1) {
newFilters.splice(index, 1);
}
delete c[i];
c[newFilters.join(mockSplit)] = filtersMap[filters[f]].call(p, p[i]);
}
}
}
function parse(p, c) {
c = c || {};
for (var i in p) {
if (!p.hasOwnProperty(i)) {
continue;
}
if (typeof p[i] === 'object') {
c[i] = (p[i].constructor === Array) ? [] : {};
parse(p[i], c[i]);
} else {
p[i] = handleStr(p[i]);
var filters = i.split(mockSplit), newFilters = [].concat(filters);
c[i] = p[i];
if (filters.length > 1) {
for (var f = 1, l = filters.length, index; f < l; f++) {
if (filters[f] in filtersMap) {
if ((index = newFilters.indexOf(filters[f])) !== -1) {
newFilters.splice(index, 1);
}
delete c[i];
c[newFilters.join(mockSplit)] = filtersMap[filters[f]].call(p, p[i]);
}
}
}
return c;
}
}
return c;
}
function handleRegexp(item) {
return new RegExp(item);
function handleRegexp(item) {
return new RegExp(item);
}
function handleStr(str) {
if (typeof str !== 'string' || str.indexOf('{') === -1 || str.indexOf('}') === -1 || str.indexOf('$') === -1) {
return str;
}
function handleStr(str) {
if (typeof str !== 'string' || str.indexOf('{') === -1 || str.indexOf('}') === -1 || str.indexOf('$') === -1) {
return str;
str = str.replace(strRegex, function (matchs, name) {
var names = name.split(varSplit);
var data = context;
names.forEach(function (n) {
if (data === '') return '';
if (n in data) {
data = data[n];
} else {
data = '';
}
str = str.replace(strRegex, function (matchs, name) {
var names = name.split(varSplit);
var data = context;
names.forEach(function (n) {
if (data === '') return '';
if (n in data) {
data = data[n];
} else {
data = '';
}
});
return data;
});
return str;
}
});
return data;
});
return str;
}
}
module.exports = mock;

12988
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,10 @@
"main": "index.js",
"scripts": {
"dev-server": "nodemon server/app.js dev -L",
"server": "node server/app.js",
"install-server": "node server/install.js"
"install-server": "node server/install.js",
"dev-client": "ykit s -p 4000",
"dev": "npm run dev-server & npm run dev-client",
"server": "node server/app.js"
},
"repository": {
"type": "git",

View File

@ -22,7 +22,6 @@ function matchApi(apiPath, apiRule) {
}
module.exports = async (ctx, next) => {
yapi.commons.log('Server Recevie Request...');
let hostname = ctx.hostname;
let config = yapi.WEBCONFIG;
let path = ctx.path;