Skip to content

Commit 7f1bdc9

Browse files
committed
Improve modelate checker
1 parent ba6bbf0 commit 7f1bdc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/modelate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ const validate = require('./validate').check;
1111
* @param opts {Object} Options for the modelate.
1212
*/
1313
function modelate(data, opts) {
14-
if ((!this.modelName && opts && !opts.model) || !data || typeof data !== 'object') {
14+
if ((!this.modelName && !(opts && !opts.model)) || !data || typeof data !== 'object') {
1515
return {};
1616
}
1717

1818
const model = (opts && opts.model) || models[this.modelName];
19-
const result = util.clone(model);
19+
const result = util.clone(model) || {};
2020

2121
for (const prop in model) {
2222
if (validate(data[prop], model[prop])) {

0 commit comments

Comments
 (0)