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

joi-plus

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi-plus - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

20

index.js

@@ -29,10 +29,10 @@ const Joi = require('@hapi/joi');

password: {
method(options = {}) {
let min = options.min;
let max = options.max;
return this.min(min).max(max).$_addRule({ name: 'password', args: { options } });
method(rules = {}) {
let min = rules.min;
let max = rules.max;
return this.min(min).max(max).$_addRule({ name: 'password', args: { rules } });
},
args: [
{
name: 'options',
name: 'rules',
assert: (value) => Object.keys(value).length > 0,

@@ -43,18 +43,18 @@ message: 'must be an object'

validate: (value, helpers, args, options) => {
let opt = args.options;
let rules = args.rules;
let regex = '^';
let message = 'must contains at least';
if (opt.lowercase) {
if (rules.lowercase) {
regex += '(?=.*[a-z])';
message += ' one lowercase character,';
}
if (opt.uppercase) {
if (rules.uppercase) {
regex += '(?=.*[A-Z])';
message += ' one uppercase character,';
}
if (opt.number) {
if (rules.number) {
regex += '(?=.*\\d)';
message += ' one numeric character,';
}
if (opt.special) {
if (rules.special) {
regex += '(?=.*[ -/:-@[-`{-~])';

@@ -61,0 +61,0 @@ message += ' one special character,';

{
"name": "joi-plus",
"version": "1.0.0",
"version": "1.0.1",
"description": "Joi with extra rules for string and array.",

@@ -5,0 +5,0 @@ "author": "Larry Png",

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