@traveloka/validation
Advanced tools
Comparing version 3.1.2 to 3.1.3
@@ -6,2 +6,14 @@ # Change Log | ||
<a name="3.1.3"></a> | ||
## [3.1.3](https://github.com/Jekiwijaya/react-schema/compare/v3.1.2...v3.1.3) (2018-10-19) | ||
### Bug Fixes | ||
* **required:** fixing object validation ([ee24242](https://github.com/Jekiwijaya/react-schema/commit/ee24242)) | ||
<a name="3.1.2"></a> | ||
@@ -8,0 +20,0 @@ ## [3.1.2](https://github.com/Jekiwijaya/react-schema/compare/v3.1.1...v3.1.2) (2018-10-19) |
@@ -7,3 +7,3 @@ "use strict"; | ||
value === '' || | ||
(Object.keys(value).length === 0 && value.constructor === Object) || | ||
(value.constructor === Object && Object.keys(value).length === 0) || | ||
(Array.isArray(value) && !value.length)) | ||
@@ -10,0 +10,0 @@ return errorMessage || 'Required'; |
{ | ||
"name": "@traveloka/validation", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./lib/index.d.ts", |
@@ -29,2 +29,12 @@ import { required } from '../index'; | ||
it("should return falsy because value 123", () => { | ||
const result = required(123); | ||
expect(result).toBeFalsy(); | ||
}); | ||
it("should return falsy because value true", () => { | ||
const result = required(true); | ||
expect(result).toBeFalsy(); | ||
}); | ||
it("should return truthy because value is {}", () => { | ||
@@ -31,0 +41,0 @@ const result = required({}); |
@@ -8,3 +8,3 @@ import { ValidationResult, Validation } from "./types"; | ||
value === '' || | ||
(Object.keys(value).length === 0 && value.constructor === Object) || | ||
(value.constructor === Object && Object.keys(value).length === 0) || | ||
(Array.isArray(value) && !value.length) | ||
@@ -11,0 +11,0 @@ ) |
Sorry, the diff of this file is not supported yet
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
140246
377