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.3.8 to 1.3.9

42

index.js

@@ -92,20 +92,28 @@ "use strict";

// 包含字符串
if (options.contain) {
if (options.contain === Number) {
if (data.search(/\d+/) === -1) {
return `${key}参数必须包含数字`
}
// 包含
if (options.in) {
let result = options.in.indexOf(data)
if (result === -1) {
return `${key}参数可选值必须为:${options.in}`
}
}
// 不包含
if (options.noContain) {
if (options.noContain === Number) {
if (data.search(/\d+/) > -1) {
return `${key}参数不能包含数字`
}
}
}
// 包含字符串
// if (options.contain) {
// if (options.contain === Number) {
// if (data.search(/\d+/) === -1) {
// return `${key}参数必须包含数字`
// }
// }
// }
// // 不包含
// if (options.noContain) {
// if (options.noContain === Number) {
// if (data.search(/\d+/) > -1) {
// return `${key}参数不能包含数字`
// }
// }
// }
// 正则表达式

@@ -142,6 +150,6 @@ if (options.reg) {

// 包含
if (options.contain) {
let result = options.contain.indexOf(data)
if (options.in) {
let result = options.in.indexOf(data)
if (result === -1) {
return `${key}参数可选值必须为${typeof data}类型${options.contain}`
return `${key}参数可选值必须为:${options.in}`
}

@@ -148,0 +156,0 @@ }

{
"name": "check-data",
"version": "1.3.8",
"version": "1.3.9",
"description": "JS数据验证器",

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

@@ -20,3 +20,3 @@ let Verify = require('../index')

"lala": 168,
"kaka": 2
"kaka": "3"
},

@@ -70,3 +70,3 @@ "email": "xxx@xx.xx"

"type": Number,
"contain": [1, 2, 3],
"in": [1, 2, 3],
"allowNull": true

@@ -73,0 +73,0 @@ }

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