MCPcopy Index your code
hub / github.com/parse-community/parse-server / replaceEqualityConstraint

Function replaceEqualityConstraint

src/RestQuery.js:828–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

826};
827
828const replaceEqualityConstraint = constraint => {
829 if (typeof constraint !== 'object') {
830 return constraint;
831 }
832 const equalToObject = {};
833 let hasDirectConstraint = false;
834 let hasOperatorConstraint = false;
835 for (const key in constraint) {
836 if (key.indexOf('$') !== 0) {
837 hasDirectConstraint = true;
838 equalToObject[key] = constraint[key];
839 } else {
840 hasOperatorConstraint = true;
841 }
842 }
843 if (hasDirectConstraint && hasOperatorConstraint) {
844 constraint['$eq'] = equalToObject;
845 Object.keys(equalToObject).forEach(key => {
846 delete constraint[key];
847 });
848 }
849 return constraint;
850};
851
852_UnsafeRestQuery.prototype.replaceEquality = function () {
853 if (typeof this.restWhere !== 'object') {

Callers 1

RestQuery.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected