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

rsuite-schema

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsuite-schema - npm Package Compare versions

Comparing version

to
0.0.1-alpha.8

17

lib/Type.js

@@ -29,3 +29,3 @@ 'use strict';

if (!this.required && (typeof value === 'undefined' || value.length === 0)) {
if (!this.required && (typeof value === 'undefined' || value === null || value === '')) {
return { hasError: false };

@@ -50,4 +50,15 @@ }

this.required = true;
this.addValidator(function (v) {
return typeof v !== 'undefined' && v.length > 0;
this.addValidator(function (value) {
//String trim
if (typeof value === 'string') {
value = value.replace(/(^\s*)|(\s*$)/g, '');
}
//String/Array length > 0
if (value && value.length && value.length > 0) {
return true;
}
return typeof value !== 'undefined' && value !== null && value !== '';
}, errorMessage);

@@ -54,0 +65,0 @@ return this;

2

package.json
{
"name": "rsuite-schema",
"version": "0.0.1-alpha.7",
"version": "0.0.1-alpha.8",
"description": "Schema for data modeling & validation",

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