Skip to content

Commit

Permalink
v13.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrodger committed Feb 11, 2021
1 parent 43bb461 commit 2db9a2c
Show file tree
Hide file tree
Showing 4 changed files with 980 additions and 878 deletions.
17 changes: 8 additions & 9 deletions lib/make_entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,9 @@ Entity.prototype.load$ = function (query, done) {

var async = is_async(si, done)

// TODO: test needed
// Empty query gives empty result.
if (q == null || 0 === Object.keys(q).length ) {
if (q == null || 0 === Object.keys(q).length) {
return async ? null : (done && done.call(si), self)
}

Expand Down Expand Up @@ -259,7 +260,7 @@ Entity.prototype.list$ = function (query, done) {
}

q = normalize_query(q, self)

var async = is_async(si, done)
var entmsg = self.private$.entargs({ qent: qent, q: q, cmd: 'list' })

Expand Down Expand Up @@ -471,7 +472,6 @@ Entity.prototype.clone$ = function () {
function normalize_query(qin, ent) {
let q = qin


if ((null == qin || 'function' === typeof qin) && ent.id != null) {
q = { id: ent.id }
} else if ('string' === typeof qin || 'number' === typeof qin) {
Expand All @@ -480,17 +480,16 @@ function normalize_query(qin, ent) {
q = null
}



// TODO: test needed
// Remove undefined values.
if(null != q) {
for(let k in q) {
if(undefined === q[k]) {
if (null != q) {
for (let k in q) {
if (undefined === q[k]) {
delete q[k]
}
}
}

return q
}

Expand Down
Loading

0 comments on commit 2db9a2c

Please sign in to comment.