Comparing version 4.1.0 to 4.2.0
@@ -10,3 +10,3 @@ # CHANGE LOG | ||
---- | ||
## [In Git](https://github.com/mattwynne/gosh/compare/v4.1.0...master) (Not released) | ||
## [In Git](https://github.com/mattwynne/gosh/compare/v4.2.0...master) (Not released) | ||
@@ -33,2 +33,24 @@ ### Added | ||
## [In Git](https://github.com/mattwynne/gosh/compare/v4.1.0...v4.2.0) (Not released) | ||
### Added | ||
* `DocumentStore#updateAll` to let you update document(s) matching a query with a function. | ||
### Changed | ||
* N/A | ||
### Deprecated | ||
* N/A | ||
### Removed | ||
* N/A | ||
### Fixed | ||
* N/A | ||
## [4.1.0](https://github.com/mattwynne/gosh/compare/v4.0.0...v4.1.0) | ||
@@ -35,0 +57,0 @@ |
@@ -49,2 +49,7 @@ 'use strict' | ||
updateAll(query, transform) { | ||
this.all(query).map(transform).forEach(this.put.bind(this)) | ||
return this | ||
} | ||
get(query) { | ||
@@ -51,0 +56,0 @@ const results = this.all(query) |
@@ -104,2 +104,22 @@ 'use strict' | ||
context('modifying values', () => { | ||
const dave = { name: 'Dave', hair: 'red' } | ||
const dan = { name: 'Dan', hair: 'red' } | ||
const susan = { name: 'Susan', hair: 'grey' } | ||
const store = new DocumentStore(document => document.name) | ||
.withIndex(document => document.hair) | ||
.put(dave) | ||
.put(dan) | ||
.put(susan) | ||
it('#updateAll stores the new value returned by the function', () => { | ||
store.updateAll({ hair: 'red' }, doc => ({ ...doc, hair: 'blue' })) | ||
assert.deepEqual(store.values(), [ | ||
{ name: 'Dave', hair: 'blue' }, | ||
{ name: 'Dan', hair: 'blue' }, | ||
susan, | ||
]) | ||
}) | ||
}) | ||
context('with a single one-to-many index', () => { | ||
@@ -106,0 +126,0 @@ it('#all finds all documents matching a query', () => { |
{ | ||
"name": "gosh", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "Great Object Storage Hooray!", | ||
@@ -5,0 +5,0 @@ "main": "lib/gosh.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
32871852
529