Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

h3lp

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

h3lp - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

16

manager/validator.d.ts

@@ -24,12 +24,12 @@ export declare class Validator {

isTime(value: any): boolean;
isBooleanFormat(value: string): boolean;
isNumberFormat(value: string): boolean;
isIntegerFormat(value: string): boolean;
isDecimalFormat(value: string): boolean;
isAlphanumeric(value: string): boolean;
isDateFormat(value: string): boolean;
isDateTimeFormat(value: string): boolean;
isTimeFormat(value: string): boolean;
isBooleanFormat(value: any): boolean;
isNumberFormat(value: any): boolean;
isIntegerFormat(value: any): boolean;
isDecimalFormat(value: any): boolean;
isAlphanumeric(value: any): boolean;
isDateFormat(value: any): boolean;
isDateTimeFormat(value: any): boolean;
isTimeFormat(value: any): boolean;
between(value: any, from: any, to: any): boolean;
includes(list: any[] | string, value: any): boolean;
}

@@ -49,5 +49,11 @@ "use strict";

isString(value) {
if (value === null || value === undefined) {
return false;
}
return typeof value === 'string';
}
isDate(value) {
if (value === null || value === undefined) {
return false;
}
if (typeof value === 'string') {

@@ -61,2 +67,5 @@ return this.isDateFormat(value);

isDateTime(value) {
if (value === null || value === undefined) {
return false;
}
if (typeof value === 'string') {

@@ -70,5 +79,11 @@ return this.isDateTimeFormat(value);

isArray(value) {
if (value === null || value === undefined) {
return false;
}
return Array.isArray(value);
}
isTime(value) {
if (value === null || value === undefined) {
return false;
}
if (typeof value === 'string') {

@@ -82,3 +97,6 @@ return this.isTimeFormat(value);

isBooleanFormat(value) {
return ['true', 'false'].includes(value);
if (value === null || value === undefined) {
return false;
}
return ['true', 'false'].includes(value.toString());
}

@@ -89,11 +107,23 @@ isNumberFormat(value) {

isIntegerFormat(value) {
if (value === null || value === undefined) {
return false;
}
return this.reInt.test(value);
}
isDecimalFormat(value) {
if (value === null || value === undefined) {
return false;
}
return this.reDecimal.test(value);
}
isAlphanumeric(value) {
if (value === null || value === undefined) {
return false;
}
return this.reAlphanumeric.test(value);
}
isDateFormat(value) {
if (value === null || value === undefined) {
return false;
}
return this.reDate.test(value);

@@ -105,5 +135,11 @@ }

isTimeFormat(value) {
if (value === null || value === undefined) {
return false;
}
return this.reTime.test(value);
}
between(value, from, to) {
if (value === null || value === undefined || from === null || from === undefined || to === null || to === undefined) {
return false;
}
return value >= from && value < to;

@@ -110,0 +146,0 @@ }

{
"name": "h3lp",
"version": "0.2.1",
"version": "0.2.2",
"description": "Helper for nodeJs",

@@ -5,0 +5,0 @@ "author": "Flavio Lionel Rita <flaviolrita@hotmail.com>",

Sorry, the diff of this file is not supported yet

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