1.0.6 • Published 3 months ago

@orago/permissions v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
3 months ago

@orago/p

Usage:

import BitwiseFlags from '@orago/permissions';

const perms = new BitwiseFlags('admin', 'member');

// Use the same names from instancing the manager, 
// If not it'll be ignored
// Leave black for no permissions

// A generated number can be used to automatically update permissions
// (ONLY DO THIS IF YOU KNOW WHAT YOU ARE DOING!!!)
const john = perms.new();
const mike = perms.new('admin');
const scott = perms.new('member');
const alex = perms.new('admin', 'member');


function test (num){
	return [
		num.has('admin'),
		num.has('member'),
	];
}

console.log(
	'john:',
	test(john), // [false, false]

	'mike:',
	test(mike), // [true, false]

	'scott:',
	test(scott), // [false, true]

	'alex:',
	test(alex) // [true, true]
);
1.0.6

3 months ago

1.0.5

3 months ago

1.0.4

7 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago