UNPKG

az-access-control

Version:

A lightweight and flexible bitmask-based role access control library for React.js apps. Control both component visibility and route-level access using a simple 2ⁿ permission model — without the hassle of writing complex permission logic.

16 lines (15 loc) 334 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPermissionSet = getPermissionSet; function getPermissionSet(sum) { var permissions = []; var power = 0; while (sum > 0) { if (sum & 1) permissions.push(Math.pow(2, power)); sum = sum >> 1; power++; } return permissions; }