Skip to content

Commit

Permalink
fix: throw TypeError for store() without passing type
Browse files Browse the repository at this point in the history
Calling store().add(...) without a type throws a TypeError: type must be set for scoped stores.  Documentation updated.
  • Loading branch information
capellini committed Sep 20, 2016
1 parent e21833c commit 9eff88d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -138,6 +138,7 @@ Rejects with:

| Name | Description |
| :-- | :-- |
| TypeError | type must be set for scoped stores |
| Error | ... |

Example
Expand Down Expand Up @@ -179,6 +180,7 @@ Rejects with:

| Name | Description |
| :-- | :-- |
| TypeError | type must be set for scoped stores |
| Error | ... |

Example: add single document
Expand Down
4 changes: 4 additions & 0 deletions lib/scoped/index.js
Expand Up @@ -3,6 +3,10 @@ module.exports = scoped
var EventEmitter = require('events').EventEmitter

function scoped (state, api, type) {
if (typeof type === 'undefined') {
throw new TypeError('type must be set for scoped stores')
}

var emitter = new EventEmitter()

var scopedApi = {
Expand Down

0 comments on commit 9eff88d

Please sign in to comment.