Closed vfonic closed 6 years ago
The Meteor SimpleSchema package is no longer maintained other than critical fixes to keep it running with each latest Meteor release. Closing non-critical issues in this repo. Anyone who cares about this may do one or more of the following:
I haven't tested this, but I believe there could be a bug in the code example in Readme documentation: https://github.com/aldeed/meteor-simple-schema#make-a-field-conditionally-required
Specifically this line:
if (this.operator === "$set" && this.value === null || this.value === "") return "required";
I assume the correct line of code would be:
if (this.operator === "$set" && (this.value === null || this.value === "")) return "required";
The issue is that
&&
operator executes before||
operator sothis.value === ""
doesn't depend onthis.operator === "$set"
. If this is intended, perhaps it should be elaborated or surrounded by parenthesis (even though you might argue that those parenthesis are redundant).https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence