We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba6bbf0 commit 7f1bdc9Copy full SHA for 7f1bdc9
lib/modelate.js
@@ -11,12 +11,12 @@ const validate = require('./validate').check;
11
* @param opts {Object} Options for the modelate.
12
*/
13
function modelate(data, opts) {
14
- if ((!this.modelName && opts && !opts.model) || !data || typeof data !== 'object') {
+ if ((!this.modelName && !(opts && !opts.model)) || !data || typeof data !== 'object') {
15
return {};
16
}
17
18
const model = (opts && opts.model) || models[this.modelName];
19
- const result = util.clone(model);
+ const result = util.clone(model) || {};
20
21
for (const prop in model) {
22
if (validate(data[prop], model[prop])) {
0 commit comments