Skip to content

Commit

Permalink
Merge pull request #66 from curbengh/no-multi-assign
Browse files Browse the repository at this point in the history
style: no-multi-assign
  • Loading branch information
curbengh committed Nov 30, 2019
2 parents 2170bf4 + 007ae44 commit c24cf93
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions lib/database.js
Expand Up @@ -97,7 +97,8 @@ class Database {
return this._models[name];
}

const model = this._models[name] = new this.Model(name, schema);
this._models[name] = new this.Model(name, schema);
const model = this._models[name];
return model;
}

Expand Down Expand Up @@ -178,8 +179,10 @@ class Database {
}
}

Database.Schema = Database.prototype.Schema = Schema;
Database.SchemaType = Database.prototype.SchemaType = SchemaType;
Database.prototype.Schema = Schema;
Database.Schema = Database.prototype.Schema;
Database.prototype.SchemaType = SchemaType;
Database.SchemaType = Database.prototype.SchemaType;
Database.version = pkg.version;

module.exports = Database;
3 changes: 2 additions & 1 deletion lib/schema.js
Expand Up @@ -757,6 +757,7 @@ class Schema {
}
}

Schema.Types = Schema.prototype.Types = Types;
Schema.prototype.Types = Types;
Schema.Types = Schema.prototype.Types;

module.exports = Schema;
6 changes: 4 additions & 2 deletions lib/util.js
Expand Up @@ -57,7 +57,8 @@ exports.setProp = (obj, key, value) => {

for (let i = 0; i < len; i++) {
const name = token[i];
cursor = cursor[name] = cursor[name] || {};
cursor[name] = cursor[name] || {};
cursor = cursor[name];
}

cursor[lastKey] = value;
Expand Down Expand Up @@ -109,7 +110,8 @@ exports.setGetter = (obj, key, fn) => {

for (let i = 0; i < len; i++) {
const name = token[i];
cursor = cursor[name] = cursor[name] || {};
cursor[name] = cursor[name] || {};
cursor = cursor[name];
}

cursor.__defineGetter__(lastKey, fn);
Expand Down

0 comments on commit c24cf93

Please sign in to comment.