@spinajs/util
Advanced tools
Comparing version 2.0.314 to 2.0.315
@@ -47,3 +47,5 @@ import { Constructor } from './fp.js'; | ||
export declare function _lt(value: number, error?: Error): (arg: unknown, name: string) => unknown; | ||
export declare function _lte(value: number, error?: Error): (arg: unknown, name: string) => unknown; | ||
export declare function _gt(value: number, error?: Error): (arg: unknown, name: string) => unknown; | ||
export declare function _gte(value: number, error?: Error): (arg: unknown, name: string) => unknown; | ||
export declare function _reg_match(reg: RegExp, error?: Error): (arg: unknown, name: string) => unknown; | ||
@@ -50,0 +52,0 @@ export declare function _glob_match(glob: string, error?: Error): (arg: unknown, name: string) => unknown; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports._one_of = exports._to_float = exports._to_int = exports._is_uuid = exports._is_email = exports._glob_match = exports._reg_match = exports._gt = exports._lt = exports._contains = exports._default = exports._non_empty = exports._non_nil = exports._non_NaN = exports._non_undefined = exports._non_null = exports._max = exports._min = exports._max_length = exports._min_length = exports._between = exports._trim = exports._to_lower = exports._to_array = exports._to_upper = exports._or = exports._is_instance_of = exports._is_object = exports._is_array = exports._is_string = exports._is_boolean = exports._contains_key = exports._is_map = exports._is_number = exports._check_arg = void 0; | ||
exports._one_of = exports._to_float = exports._to_int = exports._is_uuid = exports._is_email = exports._glob_match = exports._reg_match = exports._gte = exports._gt = exports._lte = exports._lt = exports._contains = exports._default = exports._non_empty = exports._non_nil = exports._non_NaN = exports._non_undefined = exports._non_null = exports._max = exports._min = exports._max_length = exports._min_length = exports._between = exports._trim = exports._to_lower = exports._to_array = exports._to_upper = exports._or = exports._is_instance_of = exports._is_object = exports._is_array = exports._is_string = exports._is_boolean = exports._contains_key = exports._is_map = exports._is_number = exports._check_arg = void 0; | ||
const exceptions_1 = require("@spinajs/exceptions"); | ||
@@ -303,2 +303,14 @@ const glob_to_regexp_1 = __importDefault(require("glob-to-regexp")); | ||
exports._lt = _lt; | ||
function _lte(value, error) { | ||
return function (arg, name) { | ||
if (typeof arg !== 'number') { | ||
return arg; | ||
} | ||
if (arg > value) { | ||
throw error ?? new exceptions_1.InvalidArgument(`${name} should be less than or equal ${value}`); | ||
} | ||
return arg; | ||
}; | ||
} | ||
exports._lte = _lte; | ||
function _gt(value, error) { | ||
@@ -316,2 +328,14 @@ return function (arg, name) { | ||
exports._gt = _gt; | ||
function _gte(value, error) { | ||
return function (arg, name) { | ||
if (typeof arg !== 'number') { | ||
return arg; | ||
} | ||
if (arg < value) { | ||
throw error ?? new exceptions_1.InvalidArgument(`${name} should be greater than or equal ${value}`); | ||
} | ||
return arg; | ||
}; | ||
} | ||
exports._gte = _gte; | ||
function _reg_match(reg, error) { | ||
@@ -318,0 +342,0 @@ return function (arg, name) { |
@@ -47,3 +47,5 @@ import { Constructor } from './fp.js'; | ||
export declare function _lt(value: number, error?: Error): (arg: unknown, name: string) => unknown; | ||
export declare function _lte(value: number, error?: Error): (arg: unknown, name: string) => unknown; | ||
export declare function _gt(value: number, error?: Error): (arg: unknown, name: string) => unknown; | ||
export declare function _gte(value: number, error?: Error): (arg: unknown, name: string) => unknown; | ||
export declare function _reg_match(reg: RegExp, error?: Error): (arg: unknown, name: string) => unknown; | ||
@@ -50,0 +52,0 @@ export declare function _glob_match(glob: string, error?: Error): (arg: unknown, name: string) => unknown; |
@@ -269,2 +269,13 @@ import { InvalidArgument } from '@spinajs/exceptions'; | ||
} | ||
export function _lte(value, error) { | ||
return function (arg, name) { | ||
if (typeof arg !== 'number') { | ||
return arg; | ||
} | ||
if (arg > value) { | ||
throw error ?? new InvalidArgument(`${name} should be less than or equal ${value}`); | ||
} | ||
return arg; | ||
}; | ||
} | ||
export function _gt(value, error) { | ||
@@ -281,2 +292,13 @@ return function (arg, name) { | ||
} | ||
export function _gte(value, error) { | ||
return function (arg, name) { | ||
if (typeof arg !== 'number') { | ||
return arg; | ||
} | ||
if (arg < value) { | ||
throw error ?? new InvalidArgument(`${name} should be greater than or equal ${value}`); | ||
} | ||
return arg; | ||
}; | ||
} | ||
export function _reg_match(reg, error) { | ||
@@ -283,0 +305,0 @@ return function (arg, name) { |
{ | ||
"name": "@spinajs/util", | ||
"version": "2.0.314", | ||
"version": "2.0.315", | ||
"description": "utility functions shared across @spinajs framework", | ||
@@ -50,3 +50,3 @@ "main": "lib/cjs/index.js", | ||
"dependencies": { | ||
"@spinajs/exceptions": "^2.0.314", | ||
"@spinajs/exceptions": "^2.0.315", | ||
"glob-to-regexp": "^0.4.1" | ||
@@ -53,0 +53,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
235006
1540
Updated@spinajs/exceptions@^2.0.315