event-reduce-js
Version:
javascript implementation of the event-reduce algorithm https://pubkey.github.io/event-reduce/
72 lines (66 loc) • 1.54 kB
text/typescript
import type {
ActionName,
ActionFunction
} from '../types/index.js';
import {
doNothing,
insertFirst,
insertLast,
removeFirstItem,
removeLastItem,
removeFirstInsertLast,
removeLastInsertFirst,
removeExisting,
replaceExisting,
alwaysWrong,
insertAtSortPosition,
removeExistingAndInsertAtSortPosition,
runFullQueryAgain,
unknownAction,
removeFirstInsertFirst,
removeLastInsertLast
} from './action-functions.js';
export * from './action-functions.js';
/**
* all actions ordered by performance-cost
* cheapest first
* TODO run tests on which is really the fastest
*/
export const orderedActionList: ActionName[] = [
'doNothing',
'insertFirst',
'insertLast',
'removeFirstItem',
'removeLastItem',
'removeFirstInsertLast',
'removeLastInsertFirst',
'removeFirstInsertFirst',
'removeLastInsertLast',
'removeExisting',
'replaceExisting',
'alwaysWrong',
'insertAtSortPosition',
'removeExistingAndInsertAtSortPosition',
'runFullQueryAgain',
'unknownAction'
];
export const actionFunctions: {
[k in ActionName]: ActionFunction<any>
} = {
doNothing,
insertFirst,
insertLast,
removeFirstItem,
removeLastItem,
removeFirstInsertLast,
removeLastInsertFirst,
removeFirstInsertFirst,
removeLastInsertLast,
removeExisting,
replaceExisting,
alwaysWrong,
insertAtSortPosition,
removeExistingAndInsertAtSortPosition,
runFullQueryAgain,
unknownAction
};