1.0.5 • Published 5 years ago

@xyzblocks/data-structures v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

data-structures

Data Structures

Build Status

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
1.0.5

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago