Comparing version 5.0.7 to 6.0.0
# Changelog | ||
## `6.0.0`` | ||
- Remove mustFind and mustGet methods | ||
## `5.0.7` | ||
@@ -4,0 +7,0 @@ |
@@ -90,6 +90,2 @@ import Base from './Base'; | ||
/** | ||
* Get a resource with the given id or uuid or fail loudly. | ||
*/ | ||
mustGet(id: Id): T; | ||
/** | ||
* Get resources matching criteria. | ||
@@ -110,8 +106,2 @@ * | ||
/** | ||
* Get a resource with the given id or uuid or fails loudly. | ||
*/ | ||
mustFind(query: { | ||
[key: string]: any; | ||
} | ((T: any) => boolean)): T; | ||
/** | ||
* Adds a model or collection of models. | ||
@@ -118,0 +108,0 @@ */ |
@@ -706,8 +706,2 @@ 'use strict'; | ||
/** | ||
* Get a resource with the given id or uuid or fail loudly. | ||
*/ | ||
Collection.prototype.mustGet = function (id) { | ||
return this.get(id, { required: true }); | ||
}; | ||
/** | ||
* Get resources matching criteria. | ||
@@ -759,8 +753,2 @@ * | ||
/** | ||
* Get a resource with the given id or uuid or fails loudly. | ||
*/ | ||
Collection.prototype.mustFind = function (query) { | ||
return this.find(query, { required: true }); | ||
}; | ||
/** | ||
* Adds a model or collection of models. | ||
@@ -767,0 +755,0 @@ */ |
{ | ||
"name": "mobx-rest", | ||
"version": "5.0.7", | ||
"version": "6.0.0", | ||
"description": "REST conventions for mobx.", | ||
@@ -5,0 +5,0 @@ "jest": { |
@@ -327,4 +327,3 @@ # mobx-rest | ||
This allows you to trade-off memory for speed. By default we index all the models by | ||
`primaryKey` but you can add more indexes that will be used automatically when using `filter`, | ||
`find` and `mustFind` with the object form. | ||
`primaryKey` but you can add more indexes that will be used automatically when using `filter` and `find` with the object form. | ||
@@ -406,6 +405,2 @@ ```js | ||
#### `mustGet(id: number): Model` | ||
Find a model with the given id or raise an Error. | ||
#### `filter(query: Object | Function): Array<Model>` | ||
@@ -450,13 +445,2 @@ | ||
#### `mustFind(query: Object | Function): Model` | ||
Same as `find` but it will raise an Error if the model is not found. | ||
Example: | ||
```js | ||
const pau = usersCollection.mustFind({ name: 'pau' }) | ||
pau.get('name') // => 'pau' | ||
``` | ||
#### `add(data: Array<Object|T>|T|Object): Array<Model>` | ||
@@ -734,3 +718,3 @@ | ||
author () { | ||
return users.mustGet(this.get('user_id')) | ||
return users.get(this.get('user_id')) | ||
} | ||
@@ -737,0 +721,0 @@ |
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
70421
1270
740