Document exceptions.
This commit is contained in:
parent
7ddb57078c
commit
f9c26089cd
@ -31,12 +31,16 @@ var col = new Collection()
|
|||||||
col.add('foo', true)
|
col.add('foo', true)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Throws** `DuplicateItem` if the item is already in the collection.
|
||||||
|
|
||||||
**Updating an existing item**
|
**Updating an existing item**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
col.update('foo', false)
|
col.update('foo', false)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Throws** `NoSuchItem` if the item is not in the collection.
|
||||||
|
|
||||||
**Inserting or updating an item**
|
**Inserting or updating an item**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@ -67,12 +71,17 @@ col.touch('baz')
|
|||||||
col.touch('baz').prop = false
|
col.touch('baz').prop = false
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Throws** `NoSuchItem` if the item is not in the collection.
|
||||||
|
- **Throws** `IllegalTouch` if the item is not an object.
|
||||||
|
|
||||||
**Removing an existing item**
|
**Removing an existing item**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
col.remove('bar')
|
col.remove('bar')
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Throws** `NoSuchItem` if the item is not in the collection.
|
||||||
|
|
||||||
**Removing all items**
|
**Removing all items**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
@ -97,6 +106,9 @@ var foo = col.get('foo')
|
|||||||
var bar = col.get('bar', 6.28)
|
var bar = col.get('bar', 6.28)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Throws** `NoSuchItem` if the item is not in the collection and no
|
||||||
|
fallback has been passed.
|
||||||
|
|
||||||
**Getting a read-only view of the collection**
|
**Getting a read-only view of the collection**
|
||||||
|
|
||||||
> This property is useful for example to iterate over the collection
|
> This property is useful for example to iterate over the collection
|
||||||
|
Loading…
Reference in New Issue
Block a user