check-data
Advanced tools
Comparing version 1.2.3 to 1.2.4
52
index.js
@@ -401,18 +401,16 @@ let validator = require('validator') | ||
// 自定义方法 | ||
if (handler.methods) { | ||
for (let path in handler.methods) { | ||
let data = output.data | ||
let pathArray = path.split('.') | ||
for (let key of pathArray) { | ||
if (data[key]) { | ||
data = data[key] | ||
} else { | ||
data = undefined | ||
break | ||
// 分组导出参数至指定对象 | ||
if (handler.group) { | ||
let data = output.data | ||
for (let name in handler.group) { | ||
// 对象不存在时自动创建 | ||
if (!output[name]) { | ||
output[name] = {} | ||
} | ||
let groupArray = handler.group[name] | ||
for (let path of groupArray) { | ||
if (data[path]) { | ||
output[name][path] = data[path] | ||
} | ||
} | ||
if (data !== undefined) { | ||
handler.methods[path].call(output, data) | ||
} | ||
} | ||
@@ -457,16 +455,18 @@ } | ||
// 分组导出参数至指定对象 | ||
if (handler.group) { | ||
let data = output.data | ||
for (let name in handler.group) { | ||
// 对象不存在时自动创建 | ||
if (!output[name]) { | ||
output[name] = {} | ||
} | ||
let groupArray = handler.group[name] | ||
for (let path of groupArray) { | ||
if (data[path]) { | ||
output[name][path] = data[path] | ||
// 自定义方法 | ||
if (handler.methods) { | ||
for (let path in handler.methods) { | ||
let data = output.data | ||
let pathArray = path.split('.') | ||
for (let key of pathArray) { | ||
if (data[key]) { | ||
data = data[key] | ||
} else { | ||
data = undefined | ||
break | ||
} | ||
} | ||
if (data !== undefined) { | ||
handler.methods[path].call(output, data) | ||
} | ||
} | ||
@@ -473,0 +473,0 @@ } |
{ | ||
"name": "check-data", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "JS数据验证器", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package