Comparing version 6.4.0 to 6.5.0
@@ -510,2 +510,7 @@ 'use strict'; | ||
} | ||
static override(value) { | ||
return internals.special('override', value); | ||
} | ||
}; | ||
@@ -520,2 +525,3 @@ | ||
internals.Db.prototype.append = internals.Db.append; | ||
internals.Db.prototype.override = internals.Db.override; | ||
@@ -522,0 +528,0 @@ |
@@ -49,2 +49,7 @@ 'use strict'; | ||
if (changes.type === 'override') { | ||
without.push(internals.select(path)); | ||
return internals.wrap(changes.value, without, item, path); | ||
} | ||
let row = item(path[0]); | ||
@@ -51,0 +56,0 @@ for (let i = 1; i < path.length; ++i) { |
{ | ||
"name": "penseur", | ||
"description": "Lightweight RethinkDB wrapper", | ||
"version": "6.4.0", | ||
"version": "6.5.0", | ||
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/hueniverse/penseur", |
@@ -159,7 +159,5 @@ 'use strict'; | ||
let e = 0; | ||
const onError = (err) => { | ||
expect(err).to.exist(); | ||
++e; | ||
db.connect = orig; | ||
@@ -166,0 +164,0 @@ }; |
@@ -1109,2 +1109,35 @@ 'use strict'; | ||
}); | ||
it('updates a record (override key)', (done) => { | ||
const db = new Penseur.Db('penseurtest'); | ||
db.establish(['test'], (err) => { | ||
expect(err).to.not.exist(); | ||
db.test.insert({ id: 1, a: 1, b: { c: 1, d: 1 }, e: 1 }, (err, keys) => { | ||
expect(err).to.not.exist(); | ||
db.test.update(1, { a: 2, b: { d: 2 } }, (err) => { | ||
expect(err).to.not.exist(); | ||
db.test.get(1, (err, item1) => { | ||
expect(err).to.not.exist(); | ||
expect(item1).to.equal({ id: 1, a: 2, b: { c: 1, d: 2 }, e: 1 }); | ||
db.test.update(1, { a: 3, b: db.override({ c: 2 }) }, (err) => { | ||
expect(err).to.not.exist(); | ||
db.test.get(1, (err, item2) => { | ||
expect(err).to.not.exist(); | ||
expect(item2).to.equal({ id: 1, a: 3, b: { c: 2 }, e: 1 }); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
@@ -1111,0 +1144,0 @@ |
Sorry, the diff of this file is not supported yet
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
197740
4737