Skip to content

Simple authorization library inspired by cancancan

Notifications You must be signed in to change notification settings

estepnv/rability

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rability

Simple authorization library inspired by cancancan

Installation

npm install rability

Usage

import { can, cannot, define, read, view } from "rability";

const eat = (something) => `eat${something}`;

const permission = define(
  can([read, view], "Book"),
  cannot(eat, "Candies"),
  can(view, ["TV", "YouTube"])
);

permission.readBook() // true
permission.viewTV() // true
permission.viewYouTube() // true
permission.eatCandies() // false

About

Simple authorization library inspired by cancancan

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published