Socket
Socket
Sign inDemoInstall

@briza/wegood

Package Overview
Dependencies
0
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.7 to 1.0.8

4

changelog.md
# wegood changelog
## 1.0.8
* Update: Include/Exclude rule supports boolean values.
## 1.0.7

@@ -4,0 +8,0 @@

15

lib/wegood.esm.js

@@ -155,2 +155,11 @@ function _typeof(obj) {

/**
* Is boolean type predicate.
* @param value
* @return
*/
function isBoolean(value) {
return value === false || value === true;
}
/**
* Is function type predicate.

@@ -552,3 +561,3 @@ * @param value

return function (value) {
if (isNullOrUndefined(value) || isString(value) === false && isNumber(value) === false) {
if (isNullOrUndefined(value) || !isBoolean(value) && !isString(value) && !isNumber(value)) {
return errorMsg;

@@ -576,7 +585,7 @@ }

if (inclusions.length === 0) {
console.warn("the include validation rule without any inclusions\n has no validation effect, it will be always validated as false.");
console.warn("the include validation rule without any inclusions'\n has no validation effect, it will be always validated as false.");
}
return function (value) {
if (isNullOrUndefined(value) || isString(value) === false && isNumber(value) === false) {
if (isNullOrUndefined(value) || !isBoolean(value) && !isString(value) && !isNumber(value)) {
return errorMsg;

@@ -583,0 +592,0 @@ }

@@ -159,2 +159,11 @@ 'use strict';

/**
* Is boolean type predicate.
* @param value
* @return
*/
function isBoolean(value) {
return value === false || value === true;
}
/**
* Is function type predicate.

@@ -556,3 +565,3 @@ * @param value

return function (value) {
if (isNullOrUndefined(value) || isString(value) === false && isNumber(value) === false) {
if (isNullOrUndefined(value) || !isBoolean(value) && !isString(value) && !isNumber(value)) {
return errorMsg;

@@ -580,7 +589,7 @@ }

if (inclusions.length === 0) {
console.warn("the include validation rule without any inclusions\n has no validation effect, it will be always validated as false.");
console.warn("the include validation rule without any inclusions'\n has no validation effect, it will be always validated as false.");
}
return function (value) {
if (isNullOrUndefined(value) || isString(value) === false && isNumber(value) === false) {
if (isNullOrUndefined(value) || !isBoolean(value) && !isString(value) && !isNumber(value)) {
return errorMsg;

@@ -587,0 +596,0 @@ }

{
"name": "@briza/wegood",
"version": "1.0.7",
"version": "1.0.8",
"description": "Tiny validation library, so wegood with data.",

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

@@ -20,2 +20,8 @@ /**

/**
* Is boolean type predicate.
* @param value
* @return
*/
export declare function isBoolean(value: any): value is boolean;
/**
* Is function type predicate.

@@ -22,0 +28,0 @@ * @param value

@@ -9,3 +9,3 @@ import { ValidationRule } from '.';

*/
declare function exclude(errorMsg: string, exclusions: (string | number)[]): ValidationRule;
declare function exclude(errorMsg: string, exclusions: (string | number | boolean)[]): ValidationRule;
export default exclude;

@@ -9,3 +9,3 @@ import { ValidationRule } from '.';

*/
declare function include(errorMsg: string, inclusions: (string | number)[]): ValidationRule;
declare function include(errorMsg: string, inclusions: (string | number | boolean)[]): ValidationRule;
export default include;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc