UNPKG

@unchainedshop/plugins

Version:

Official plugin collection for the Unchained Engine with payment, delivery, and pricing adapters

25 lines (24 loc) 808 B
import { FilterDirector, FilterAdapter } from '@unchainedshop/core'; const StrictQualFilter = { ...FilterAdapter, key: 'shop.unchained.filters.strict-qual', label: 'Simple Strict Equal DB Filter', version: '1.0.0', orderIndex: 0, actions: (params) => { return { ...FilterAdapter.actions(params), transformProductSelector: async (lastSelector, options) => { const { key, value } = options || {}; if (key) { return { ...lastSelector, [key]: value !== undefined ? value : { $exists: true }, }; } return lastSelector; }, }; }, }; FilterDirector.registerAdapter(StrictQualFilter);