UNPKG

forest-express-sequelize

Version:

Official Express/Sequelize Liana for Forest

16 lines (15 loc) 549 B
"use strict"; function makeParseFilter(FiltersParser, publicExports) { /** * @param {*} filter * @param {*} modelSchema * @param {string} timezone * @returns {Promise<any>} Sequelize condition */ return function parseFilter(filter, modelSchema, timezone) { if (!publicExports.opts) throw new Error('Liana must be initialized before using parseFilter'); const parser = new FiltersParser(modelSchema, timezone, publicExports.opts); return parser.perform(JSON.stringify(filter)); }; } module.exports = makeParseFilter;