@jswork/bitwise-permission-manager
v1.0.1
Published
Bitwise permission manager.
Downloads
4
Maintainers
Readme
bitwise-permission-manager
Bitwise permission manager.
installation
npm install @jswork/bitwise-permission-manager
usage
import bpm from '@jswork/bitwise-permission-manager';
let r = 0b100;
let w = 0b010;
let x = 0b001;
let target = 0b111;
// add
let p = bpm.add(r, w, x); // 0b111
// remove
let p = bpm.remove(target, r, w, x); // 0b000
// toggle
let p = bpm.toggle(target, r, w, x); // 0b000
// has
let p = bpm.has(target, r, w, x); // true
license
Code released under the MIT license.