prisma-mock
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -98,7 +98,21 @@ "use strict"; | ||
if (typeof dir === "object") { | ||
const schema = model.fields.find(field => { | ||
return field.name === key; | ||
}); | ||
if (!schema) { | ||
return 0; | ||
} | ||
const submodel = datamodel.models.find(model => { | ||
return getCamelCase(model.name) === key; | ||
return model.name === schema.type; | ||
}); | ||
const delegate = Delegate(key, submodel); | ||
const res = delegate._sortFunc(dir)(incl(a)[key], incl(b)[key]); | ||
const delegate = Delegate(getCamelCase(schema.type), submodel); | ||
const valA = incl(a); | ||
const valB = incl(b); | ||
if (!valB || !valB[key]) { | ||
return 0; | ||
} | ||
if (!valA || !valA[key]) { | ||
return 0; | ||
} | ||
const res = delegate._sortFunc(dir)(valA[key], valB[key]); | ||
if (res !== 0) { | ||
@@ -108,3 +122,3 @@ return res; | ||
} | ||
else { | ||
else if (!!a && !!b) { | ||
if (a[key] > b[key]) { | ||
@@ -111,0 +125,0 @@ return dir === "asc" ? 1 : -1; |
{ | ||
"name": "prisma-mock", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Mock prisma for unit testing database", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
41176
705