UNPKG

@mcabreradev/filter

Version:

A powerful, SQL-like array filtering library for TypeScript and JavaScript with advanced pattern matching, MongoDB-style operators, deep object comparison, and zero dependencies

24 lines 721 B
export const applyArrayOperators = (value, operators) => { if (operators.$in !== undefined) { if (!operators.$in.includes(value)) return false; } if (operators.$nin !== undefined) { if (operators.$nin.includes(value)) return false; } if (operators.$contains !== undefined) { if (!Array.isArray(value)) return false; if (!value.includes(operators.$contains)) return false; } if (operators.$size !== undefined) { if (!Array.isArray(value)) return false; if (value.length !== operators.$size) return false; } return true; }; //# sourceMappingURL=array.operators.js.map