No description
This repository has been archived on 2024-10-16. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
Killer Boss Original a30568a6aa
Update package.json
2023-06-22 13:08:43 +02:00
.github/workflows Update npm-publish.yml 2023-06-08 17:21:35 +02:00
src Update index.ts 2023-06-08 18:07:49 +02:00
.gitignore init 2023-06-04 15:15:34 +02:00
.npmrc Initial commit 2023-06-04 14:55:16 +02:00
LICENSE Initial commit 2023-06-04 14:55:16 +02:00
package.json Update package.json 2023-06-22 13:08:43 +02:00
README.md Update README.md 2023-06-08 16:57:51 +02:00
tsconfig.json ESNext 2023-06-22 13:02:06 +02:00

Permission Checker

/!\ We haven't tested it on pure JavaScript and on CommonJS yet.

checklist

import { checkList } from "permission-checker";

console.log(checkList(["permission1", "permission2.subPermission1"], ["requiredPermission1"]))
// permission1 != requiredPermission1 && permission2.subPermission1 != requiredPermission1, checkList = false
console.log(checkList(["*"], ["requiredPermission1"]))
// * catch all, always true
console.log(checkList(["permission1"], ["*"]))
// if in the first array there isn't * this is always false

console.log(checkList(["permission1"], ["permission1.subPermission1"]))
// permission1 includes subPermission1, this is true

checksingle

is the same of checklist but without an array.

import { checkSingle } from "permission-checker";
console.log(checkSingle("*", "permission1")) // true