Comparing version 1.0.2 to 1.0.3
30
index.js
@@ -15,20 +15,12 @@ 'use strict'; | ||
if ( typeof this.json[item] == "undefined" && this.verify[item].request ) { | ||
return reject(this.answer(false, { | ||
code: 100, | ||
error: this.verify[item].error && this.verify[item].error.isUndefined|| | ||
`${item} is undefined.` | ||
})) | ||
return reject(this.error(100, this.verify[item].error && this.verify[item].error.isUndefined|| | ||
`${item} is undefined.`)) | ||
} | ||
if ( typeof this.json[item] != this.verify[item].type && typeof this.json[item] != "undefined" ) { | ||
return reject(this.answer(false, { | ||
code: 200, | ||
error: this.verify[item].error && this.verify[item].error.isInvalidType|| | ||
`${item} is invalid type.` | ||
})) | ||
return reject(this.error(200, this.verify[item].error && this.verify[item].error.isInvalidType|| | ||
`${item} is invalid type.`)) | ||
} | ||
resolve(this.answer(true, { | ||
data: this.json | ||
})) | ||
resolve(this.json) | ||
}); | ||
@@ -38,12 +30,12 @@ }) | ||
answer(ok, param) { | ||
if ( !ok ) { | ||
return { ok, code: param.code, error: param.error} | ||
} else { | ||
return { ok, data: param.data} | ||
} | ||
error(error, code){ | ||
return { ok: false, code, error} | ||
} | ||
success(data){ | ||
return { ok: true, data } | ||
} | ||
} | ||
module.exports = JAres; |
{ | ||
"name": "jares", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "simple json api ewsult format", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
18396
28