UNPKG

mysql-all-in-one

Version:

A package that allows you to have a complete interaction with a MYSQL database, allowing to connect to the database, retrieve data and create queries.

39 lines (38 loc) 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isOperatorOptionsObject = exports.isColumnRelationObject = void 0; const isColumnRelationObject = (value) => value !== undefined && value !== null && !Array.isArray(value) && typeof value === 'object' && Object.entries(value).reduce((acc, [key, val]) => acc && typeof key === 'string' && typeof val === 'string', true); exports.isColumnRelationObject = isColumnRelationObject; const OperatorOptionsObjectKeys = [ 'like', 'notlike', 'rlike', 'notrlike', 'regexp', 'notregexp', 'between', 'notbetween', 'in', 'notin', 'is', 'isnot', '<=>', '>', '<', '>=', '<=', '<>', '!=', '=', ]; const isOperatorOptionsObject = (val) => { return (typeof val === 'object' && val !== null && val !== undefined && Object.keys(val).reduce((prev, cur) => prev || OperatorOptionsObjectKeys.includes(cur), false)); }; exports.isOperatorOptionsObject = isOperatorOptionsObject;