Comparing version 0.2.1 to 0.2.2
@@ -0,1 +1,5 @@ | ||
# 0.2.2 | ||
* Fixed validate function to ignore the attr if the value is null | ||
# 0.2.1 | ||
@@ -2,0 +6,0 @@ |
@@ -10,4 +10,6 @@ /// <reference types="promise" /> | ||
export declare function attr(type: string): (target: Object, key: string) => void; | ||
/** Model basic type validator function */ | ||
/** Model basic type validator function */ | ||
/** | ||
* Model basic type validator function | ||
* @param model The model object to be validated | ||
*/ | ||
export declare function validate(model: Object): Promise.IThenable<{}>; |
@@ -27,4 +27,6 @@ "use strict"; | ||
exports.attr = attr; | ||
/** Model basic type validator function */ | ||
/** Model basic type validator function */ | ||
/** | ||
* Model basic type validator function | ||
* @param model The model object to be validated | ||
*/ | ||
function validate(model) { | ||
@@ -34,3 +36,3 @@ return new Promise(function (resolve, reject) { | ||
for (var key in data) { | ||
if (model[key] === undefined) | ||
if (model[key] === undefined || !model[key]) | ||
continue; | ||
@@ -37,0 +39,0 @@ if (typeof model[key] !== data[key]) { |
{ | ||
"name": "classpass", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"main": "dist/index.js", | ||
@@ -22,3 +22,4 @@ "bugs": "https://github.com/sorakthunly/classpass/issues", | ||
"reflect-metadata": "^0.1.10", | ||
"typescript": "^2.2.2" | ||
"typescript": "^2.2.2", | ||
"@types/promise": "^7.1.30" | ||
}, | ||
@@ -28,5 +29,4 @@ "devDependencies": { | ||
"@types/node": "^7.0.12", | ||
"@types/promise": "^7.1.30", | ||
"@types/reflect-metadata": "0.0.5" | ||
} | ||
} |
@@ -19,4 +19,6 @@ import 'reflect-metadata'; | ||
/** Model basic type validator function */ | ||
/** Model basic type validator function */ | ||
/** | ||
* Model basic type validator function | ||
* @param model The model object to be validated | ||
*/ | ||
export function validate(model: Object) { | ||
@@ -27,3 +29,3 @@ return new Promise((resolve, reject) => { | ||
for (let key in data) { | ||
if (model[key] === undefined) continue; | ||
if (model[key] === undefined || !model[key]) continue; | ||
if (typeof model[key] !== data[key]) { | ||
@@ -30,0 +32,0 @@ const validBoolean = [0, 1].indexOf(model[key]) > -1; |
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
10444
3
216
4
+ Added@types/promise@^7.1.30
+ Added@types/promise@7.1.30(transitive)