@allbin/entity-logic
TypeScript icon, indicating that this package has built-in type declarations

0.16.1 • Public • Published

@allbin/entity-logic

Entity filter executor

How to use

import {
  EntityLogic,
  Entity,
  EntitySchema,
  Filter,
  FilterCondition
} from '@allbin/entity-logic'

const schema: EntitySchema = {
  /* ... */
};

const entities: Entity = [ /* ... */ ];

const hasValue: FilterCondition = {
  field: 'user.1',
  propType: 'string',
  operator: 'known',
}

const matchesWildcardString: FilterCondition = {
  field: 'user.1',
  propType: 'string',
  operator: 'matches',
  value: 'wild*cards'
};

const filter: Filter = [
  hasValue,
  matchesWildcardString,
];

const logic = EntityLogic(schema);  // need one of these per schema

const result = logic.execute(entities, filter);

/@allbin/entity-logic/

    Package Sidebar

    Install

    npm i @allbin/entity-logic

    Weekly Downloads

    16

    Version

    0.16.1

    License

    ISC

    Unpacked Size

    104 kB

    Total Files

    16

    Last publish

    Collaborators

    • noahhakansson
    • mdjarv
    • pscz