New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

check-data

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-data - npm Package Compare versions

Comparing version 1.7.7 to 1.7.8

schema.js

25

index.js

@@ -5,2 +5,4 @@ "use strict"

let schema = require('./schema')
let { methods, extend } = require('./methods')

@@ -200,3 +202,3 @@

else if (methods[options]) {
if (data === undefined || data === '') {

@@ -206,11 +208,9 @@ return { data }

let { err, data: subData } = methods[options].type({ data })
if (err) {
return {
error: `${key}值${err}`
}
let { error, data: subData } = methods[options].type({ data })
if (error) {
return { error: `${key}值${error}` }
} else {
return { data: subData }
}
return {
data: subData
}

@@ -254,9 +254,8 @@ }

// 预定义数据模型表达式
Validator.schema = function (name, expression) {
Validator.schema = schema
}
// 验证类型扩展
Validator.use = extend
module.exports = Validator
module.exports = Validator
{
"name": "check-data",
"version": "1.7.7",
"version": "1.7.8",
"description": "JS对象验证器",
"main": "index.js",
"scripts": {
"test": "nodemon test/example"
"dev": "nodemon test/example"
},

@@ -9,0 +9,0 @@ "author": "https://github.com/xiangle/verify.git",

@@ -13,9 +13,9 @@ ### Installation

* `data` * - 输入验证数据,类型参考type选项
* `data` *Objcte, Array, String, Number, Date, Boolean* - 输入待验证数据
* `options` * - 数据验证表达式,类型参考type选项
* `options` *Objcte, Array, Function* - 数据验证表达式,类型参考type选项
* `customize` *Objcte* - 自定义数据导出对象(可选)
* `customize.$` *Function* - 自定义数据导出方法,使用验证后的数据创建新的数据结构,this和函数第一个参数指向已验证数据
* `customize.$` *Function* - 自定义数据导出方法,使用验证后的数据创建新的数据结构,this和函数第一个参数指向已验证数据。该函数返回值中支持多层内嵌函数表达式,用于动态生成返回值。

@@ -31,5 +31,5 @@ ### 输出

### 公共选项
### options - 公共选项
* `type` * - 表示数据类型,可选类型有String、Number、Object、 Array、Date、Boolean、"MongoId"、"MobilePhone"(扩展类型用字符串表示)
* `type` *String, Number, Object, Array, Date, Boolean, "MongoId", "MobilePhone", 'Email'* - 数据类型,扩展类型用字符串表示

@@ -51,3 +51,3 @@ * `name` *String* - 自定义参数名称,用于错误返回值中替换默认参数名

### 不同数据类型的私有选项
### options - 针对指定数据类型的私有选项

@@ -54,0 +54,0 @@ #### String

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc