mentie 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/modules/validations.js +2 -2
- package/package.json +1 -1
package/modules/validations.js
CHANGED
|
@@ -31,8 +31,8 @@ export const require_props = ( obj={}, required_properties=[], error_on_fail=tru
|
|
|
31
31
|
const missing_properties = required_properties.filter( prop => !keys.includes( prop ) )
|
|
32
32
|
|
|
33
33
|
// If properties are missing, throw errors or return false
|
|
34
|
-
if( error_on_fail &&
|
|
35
|
-
if(
|
|
34
|
+
if( error_on_fail && missing_properties.length ) throw new Error( `Missing required properties on object: ${ missing_properties.join( ', ' ) }` )
|
|
35
|
+
if( missing_properties.length ) return false
|
|
36
36
|
|
|
37
37
|
// If all good, return true
|
|
38
38
|
return true
|