@xyzblocks/data-structures
v1.0.5
Published
Data Structures
Downloads
1
Readme
data-structures
Data Structures
Installation
npm install @xyzblocks/data-structures --save
API
Graph
Methods
static depthFirstSearch<T>(comparatorFn: (a: T, b: T) => boolean, value: T, vertices: Array<IGraphVertex<T>>): IGraphVertex<T>
IGraphVertex
const graphVertex: IGraphVertex<string> = {
neighbours: [
{
neighbours: [],
value: 'B',
}
],
value: 'A',
};
IPermission
const permission: IPermission = {
operation: 'write';
resource: 'database';
};
IRole
const role: IRole = {
inheritedRoles: ['role-1'];
name: 'role-2';
permissions: [
{
operation: 'write';
resource: 'database';
},
];
};
OneDimensionalStateTransitionTable
Methods
addTransition(from: any, to: any): OneDimensionalStateTransitionTable
allowed(from: any, to: any): boolean
RoleBasedAccessControl
Methods
authorized(roleName: string, resource: string, operation: string): boolean
TwoDimensionalStateTransitionTable
Methods
addTransition(from: any, event: any, to: any): TwoDimensionalStateTransitionTable
next(from: any, event: any): any