@chantouchsek/validatorjs
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -5,2 +5,11 @@ # Changelog | ||
### [1.1.4](https://github.com/chantouchsek/validator-js/compare/v1.1.3...v1.1.4) (2022-09-15) | ||
### Bug Fixes | ||
* :fire: remove change string length with numeric validator ([28505da](https://github.com/chantouchsek/validator-js/commit/28505da073e250feb6bdb571ddd883a236777f28)) | ||
* :fire: remove change string length with numeric validator ([f5ee019](https://github.com/chantouchsek/validator-js/commit/f5ee0190a2a58b98a7554d3a6cc6664b0b995ace)) | ||
* **deps:** bump actions/setup-node from 3.3.0 to 3.4.1 ([a6ea5b2](https://github.com/chantouchsek/validator-js/commit/a6ea5b2653a1b28112a9714d8caeb5bc35ec0148)) | ||
### [1.1.3](https://github.com/chantouchsek/validator-js/compare/v1.1.2...v1.1.3) (2022-07-08) | ||
@@ -7,0 +16,0 @@ |
@@ -117,3 +117,2 @@ "use strict"; | ||
static _setRules() { | ||
const numericRules = ['numeric']; | ||
Rule.rules = { | ||
@@ -132,5 +131,4 @@ ...this.rules, | ||
const val2 = val; | ||
if (!(0, utils_1.isValidDate)(val1) || !(0, utils_1.isValidDate)(val2)) { | ||
if (!(0, utils_1.isValidDate)(val1) || !(0, utils_1.isValidDate)(val2)) | ||
return false; | ||
} | ||
return new Date(val1).getTime() <= new Date(val2).getTime(); | ||
@@ -161,5 +159,4 @@ }, | ||
for (const re of req) { | ||
if (!(0, utils_1.objectPath)(this.validator.input, re)) { | ||
if (!(0, utils_1.objectPath)(this.validator.input, re)) | ||
return true; | ||
} | ||
} | ||
@@ -192,7 +189,2 @@ return this.validator.getRule('required').validate(val, {}); | ||
const size = this.getSize(val); | ||
const numericRule = this.validator.getRule('numeric'); | ||
const hasNumeric = this.validator._hasRule(this.attribute, numericRules); | ||
if (numericRule.validate(val, {}) && hasNumeric && !(0, utils_1.isFloat)(val)) { | ||
return String(val).trim().length >= parseInt(req); | ||
} | ||
return size >= req; | ||
@@ -202,7 +194,2 @@ }, | ||
const size = this.getSize(val); | ||
const numericRule = this.validator.getRule('numeric'); | ||
const hasNumeric = this.validator._hasRule(this.attribute, numericRules); | ||
if (numericRule.validate(val, {}) && hasNumeric && !(0, utils_1.isFloat)(val)) { | ||
return String(val).trim().length <= parseInt(req); | ||
} | ||
return size <= req; | ||
@@ -227,3 +214,2 @@ }, | ||
let list = []; | ||
let i; | ||
if (!(0, utils_1.isEmpty)(val)) { | ||
@@ -326,4 +312,4 @@ list = this.getParameters(); | ||
Rule._setRules(); | ||
const async = this.isAsync(name); | ||
const rule = new Rule(name, Rule.rules[name], async); | ||
const isAsync = this.isAsync(name); | ||
const rule = new Rule(name, Rule.rules[name], isAsync); | ||
rule.setValidator(validator); | ||
@@ -330,0 +316,0 @@ return rule; |
@@ -24,7 +24,7 @@ "use strict"; | ||
// check 3: ipv6 should contain no less than 3 sector | ||
// minimum ipv6 addres - ::1 | ||
// minimum ipv6 address - ::1 | ||
if (3 > hextets.length) | ||
return false; | ||
// check 4: ipv6 should contain no more than 8 sectors | ||
// only 1 edge case: when first or last sector is ommited | ||
// only 1 edge case: when first or last sector is omitted | ||
const isEdgeCase = hextets.length == 9 && | ||
@@ -45,3 +45,3 @@ colons != null && | ||
return false; | ||
// check 7: all of hextet values should be less than ffff (in hexadeimal) | ||
// check 7: all of hextet values should be less than ffff (in hexadecimal) | ||
// checking using length of hextet. lowest invalid value's length is 5. | ||
@@ -48,0 +48,0 @@ // so all valid hextets are length of 4 or less |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isFloat = exports.onlyDigits = exports.toSnakeCase = exports.toCamelCase = exports.formatter = void 0; | ||
exports.onlyDigits = exports.toSnakeCase = exports.toCamelCase = exports.formatter = void 0; | ||
const formatter = (attribute) => { | ||
@@ -23,10 +23,1 @@ return attribute.replace(/[_.\[]/g, ' ').replace(/]/g, ''); | ||
exports.onlyDigits = onlyDigits; | ||
function isFloat(n, shouldCoerce = true) { | ||
if (shouldCoerce) { | ||
if (typeof n === 'string') { | ||
n = parseFloat(n); | ||
} | ||
} | ||
return n === +n && n !== (n | 0); | ||
} | ||
exports.isFloat = isFloat; |
{ | ||
"name": "@chantouchsek/validatorjs", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "The validator-js library makes data validation in JavaScript very easy in both the browser and Node.js.", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -5,2 +5,1 @@ export declare const formatter: (attribute: string) => string; | ||
export declare function onlyDigits(str: string | boolean | number): boolean; | ||
export declare function isFloat(n: string | number, shouldCoerce?: boolean): boolean; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
394225
9139