Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1 to 1.7.2

29

index.js

@@ -7,3 +7,2 @@ "use strict"

class validator {

@@ -28,3 +27,3 @@

// 选项为验证器表达式(type作为内部保留关键字,应避免在外部使用type属性,否则会产生命名冲突)
// 选项为验证器表达式(type作为内部保留关键字,应避免使用同名的type属性,否则会产生命名冲突)
if (options.type) {

@@ -34,3 +33,3 @@

// 前置空值拦截
// 空值拦截
if (data === undefined || data === '') {

@@ -96,8 +95,15 @@

let [itemOptions, parentOptions] = options
if (data === undefined) {
if (parentOptions && parentOptions.allowNull === false) {
let [itemOptions] = options
if (Array.isArray(data)) {
if (itemOptions.allowNull === false) {
if (data.length === 0) {
return {
error: `数组${key}值不能为空`
}
}
}
} else {
if (itemOptions.allowNull === false) {
return {
error: `数组${key}值不能为空`
error: `${key}必须为数组`
}

@@ -111,8 +117,2 @@ } else {

if (!Array.isArray(data)) {
return {
error: `${key}值必须为数组`
}
}
let dataArray = []

@@ -216,3 +216,2 @@ let itemKey = 0

/**

@@ -219,0 +218,0 @@ * 验证器

{
"name": "check-data",
"version": "1.7.1",
"version": "1.7.2",
"description": "JS对象验证器",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -17,3 +17,3 @@ ### Installation

* `export` *Objcte* - 定义数据导出方法,从验证结果中选择要导出的数据,方法中this和第一个参数均绑定验证结果(可选)
* `export` *Objcte* - 自定义数据导出方法,使用验证后的数据创建新的数据结构,通过方法中的this和第一个函数参数提取验证数据(可选)

@@ -28,3 +28,3 @@ ### 输出

* `${name}` *Objcte* - 由export导出方法生成的对象,命名与export函数名一致(带空值过滤)
* `${name}` *Objcte* - 由export对象中构造方法导出的数据,命名与export中函数名一致(带空值过滤)

@@ -319,4 +319,3 @@

{
filter() {
let { search, email, integral } = this
filter({ search, email, integral }) {
return {

@@ -323,0 +322,0 @@ "email": email,

@@ -140,3 +140,2 @@ "use strict"

"type": Array,
// "allowNull": false,
method(data) {

@@ -152,4 +151,3 @@ if (data.length) {

{
filter() {
let { search, email, integral } = this
filter({ search, email, integral }) {
return {

@@ -173,5 +171,6 @@ "email": email,

console.log(error)
} else {
console.log(data.user)
console.log(filter)
}
return
}
console.log(data)
console.log(filter)
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