Skip to content

Repository files navigation

@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);

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages