diff --git a/.eslintrc.json b/.eslintrc.json
index ee8e393..a1a36ec 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -3,5 +3,19 @@
"extends": ["./node_modules/sanctuary-style/eslint-es3.json"],
"env": {
"node": true
- }
+ },
+ "overrides": [
+ {
+ "files": ["*.md"],
+ "plugins": ["markdown"],
+ "env": {"es6": true},
+ "globals": {"checkPermission": false, "findRoles": false},
+ "rules": {
+ "strict": ["off"],
+ "no-extra-semi": ["off"],
+ "semi-style": ["off"],
+ "semi": ["off"]
+ }
+ }
+ ]
}
diff --git a/README.md b/README.md
index 87b2b21..3dec918 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,7 @@
[![Dependencies](https://david-dm.org/Avaq/permissionary.svg)](https://david-dm.org/Avaq/permissionary)
[![Build Status](https://travis-ci.org/Avaq/permissionary.svg?branch=master)](https://travis-ci.org/Avaq/permissionary)
[![Code Coverage](https://codecov.io/gh/Avaq/permissionary/branch/master/graph/badge.svg)](https://codecov.io/gh/Avaq/permissionary)
+[![Greenkeeper badge](https://badges.greenkeeper.io/Avaq/permissionary.svg)](https://greenkeeper.io/)
Tiny and framework-agnostic role-based permission management using
a model of *composition* over inheritance.
@@ -40,7 +41,7 @@ assign both roles to that user.
## API
-
+#### `checkPermission :: StrMap (Array String) -> Array String -> String -> Boolean`
A [curried][5] function that takes three arguments and returns a Boolean:
@@ -85,7 +86,7 @@ canAlice('users.create');
true
```
-
+#### `findRoles :: StrMap (Array String) -> String -> Array String`
A [curried][5] function that takes two arguments and returns an Array
of role names:
diff --git a/index.js b/index.js
index 1d2e036..0f7bb5b 100644
--- a/index.js
+++ b/index.js
@@ -15,6 +15,7 @@
//.
//. ## Usage
//.
+//.
//. ```js
//. var {checkPermission, findRoles} = require('permissionary');
//. ```
@@ -69,26 +70,26 @@ var hasProp = Object.prototype.hasOwnProperty;
//. > var createVerifier = checkPermission({
//. . 'content-reader': ['content.read', 'images.read'],
//. . 'content-writer': ['content.write', 'images.upload'],
-//. . 'superadmin': ['*']
-//. . });
+//. . 'superadmin': ['*']
+//. . })
//.
//. // Let's say our user Bob is a content-reader, and also a content-writer.
-//. > var canBob = createVerifier(['content-reader', 'content-writer']);
+//. > var canBob = createVerifier(['content-reader', 'content-writer'])
//.
//. // And Alice is an administrator.
-//. > var canAlice = createVerifier(['superadmin']);
+//. > var canAlice = createVerifier(['superadmin'])
//.
//. // Bob has this permission through his content-reader role.
-//. > canBob('content.read');
+//. > canBob('content.read')
//. true
//.
//. // Bob does not have this permission.
-//. > canBob('users.create');
+//. > canBob('users.create')
//. false
//.
//. // Alice, however, does. She has all permissions (even the ones
//. // we haven't thought of yet).
-//. canAlice('users.create');
+//. canAlice('users.create')
//. true
//. ```
function checkPermission(grants, roles, permission) {
@@ -126,8 +127,8 @@ function checkPermission(grants, roles, permission) {
//. > var getRequiredRoles = findRoles({
//. . 'content-reader': ['content.read', 'images.read'],
//. . 'content-writer': ['content.write', 'images.upload'],
-//. . 'superadmin': ['*']
-//. . });
+//. . 'superadmin': ['*']
+//. . })
//.
//. > getRequiredRoles('content.read')
//. ['content-reader', 'superadmin']
diff --git a/package.json b/package.json
index 6ec6289..8686da8 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,6 @@
},
"devDependencies": {
"codecov": "^3.0.0",
- "sanctuary-scripts": "^1.0.1"
+ "sanctuary-scripts": "^1.5.0"
}
}