Skip to content

Commit

Permalink
docs: Make additional parameters more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
mblarsen committed Mar 31, 2018
1 parent 034e406 commit 28001d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ Examples:
```javascript
acl.rule('create', Post)
acl.rule('edit', Post, (user, post) => post.userId === user.id)
acl.rule('edit', Post, (user, post, verb, any, other, value, passed) => true)
acl.rule('edit', Post, (user, post, verb, additionalParameter, secondAdditionalParameter) => true)
acl.rule('delete', Post, false) // deleting disabled
```

**Parameters**

- `verbs` **([Array][14]<[string][15]> | [string][15])**
- `subject` **([Function][16] \| [Object][17] \| [string][15])**
- `test` **[Boolean][18]** =true (optional, default `true`)
- `test` **([Boolean][18] \| [Function][16])** =true (optional, default `true`)

Returns **[Acl][19]**

Expand All @@ -173,7 +173,7 @@ If the policy is a function it will be new'ed up before use.
this.delete = false // not really necessary since an abscent
// verb has the same result
},
edit(user, post, verb, any, other, value, passed) {
edit(user, post, verb, additionalParameter, secondAdditionalParameter) {
return post.id === user.id
}
}
Expand Down Expand Up @@ -219,7 +219,7 @@ string.
```javascript
acl->can(user, 'create', Post)
acl->can(user, 'edit', post)
acl->can(user, 'edit', post, any, other, value, passed)
acl->can(user, 'edit', post, additionalParameter, secondAdditionalParameter)
```

Note that these are also available on the user if you've used
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Acl {
* ```javascript
* acl.rule('create', Post)
* acl.rule('edit', Post, (user, post) => post.userId === user.id)
* acl.rule('edit', Post, (user, post, verb, any, other, value, passed) => true)
* acl.rule('edit', Post, (user, post, verb, additionalParameter, secondAdditionalParameter) => true)
* acl.rule('delete', Post, false) // deleting disabled
* ```
*
Expand Down Expand Up @@ -66,7 +66,7 @@ class Acl {
* this.delete = false // not really necessary since an abscent
* // verb has the same result
* },
* edit(user, post, verb, any, other, value, passed) {
* edit(user, post, verb, additionalParameter, secondAdditionalParameter) {
* return post.id === user.id
* }
* }
Expand Down Expand Up @@ -119,7 +119,7 @@ class Acl {
* ```javascript
* acl->can(user, 'create', Post)
* acl->can(user, 'edit', post)
* acl->can(user, 'edit', post, any, other, value, passed)
* acl->can(user, 'edit', post, additionalParameter, secondAdditionalParameter)
* ```
*
* Note that these are also available on the user if you've used
Expand Down

0 comments on commit 28001d3

Please sign in to comment.