Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mobx-rest

Package Overview
Dependencies
Maintainers
3
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-rest - npm Package Compare versions

Comparing version 5.0.7 to 6.0.0

3

CHANGELOG.md
# Changelog
## `6.0.0``
- Remove mustFind and mustGet methods
## `5.0.7`

@@ -4,0 +7,0 @@

10

lib/Collection.d.ts

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc