permix
Version:
Permix is a lightweight, framework-agnostic, type-safe permissions management library for JavaScript applications on the client and server sides.
17 lines (14 loc) • 327 B
JavaScript
function createCheckContext(...params) {
const [entity, action] = params;
return {
entity,
actions: Array.isArray(action) ? action : [action]
};
}
function pick(obj, keys) {
return keys.reduce((acc, key) => {
acc[key] = obj[key];
return acc;
}, {});
}
export { createCheckContext as c, pick as p };