UNPKG

handsontable

Version:

Handsontable is a JavaScript Data Grid available for React, Angular and Vue.

18 lines 1.05 kB
import { getDecreasedIndexes, getIncreasedIndexes } from "./actionsOnIndexes.mjs"; import { throwWithCause } from "../../../helpers/errors.mjs"; import { getListWithInsertedItems as sequenceStrategyInsert, getListWithRemovedItems as sequenceStrategyRemove } from "./indexesSequence.mjs"; import { getListWithInsertedItems as physicalStrategyInsert, getListWithRemovedItems as physicalStrategyRemove } from "./physicallyIndexed.mjs"; const alterStrategies = new Map([['indexesSequence', { getListWithInsertedItems: sequenceStrategyInsert, getListWithRemovedItems: sequenceStrategyRemove }], ['physicallyIndexed', { getListWithInsertedItems: physicalStrategyInsert, getListWithRemovedItems: physicalStrategyRemove }]]); const alterUtilsFactory = indexationStrategy => { if (alterStrategies.has(indexationStrategy) === false) { throwWithCause(`Alter strategy with ID '${indexationStrategy}' does not exist.`); } return alterStrategies.get(indexationStrategy); }; export { getDecreasedIndexes, getIncreasedIndexes, alterUtilsFactory };