You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple-schema does not seem to be typeconverting some string values of a nested object into numbers/decimal numbers when I call clean. I was looking through the code of simple-schema.js and it's something in here:
If I understand correctly, looksLikeModifier(val) needs to be true in order to get to this line: } else if (_.isObject(opVal) && ("$each" in opVal)) { which I think is what would typeconvert the nested values? I don't really understand what the "$each" is except that opVal is the first argument to the iterator of the _.each call and represents the current element. http://underscorejs.org/#each
Some of the values i'm trying to convert include negative integers and negative decimals.
Let me know what you think and if i'm totally misunderstanding what's going on and doing something wrong.
The text was updated successfully, but these errors were encountered:
I've been reading over the code in simple-schema.js and looksLikeModifier(val) seems to be for mongo modifiers, which doesn't apply to the situation i'm in. It just seems like in the else portion of the looksLikeModifier(val) if-block there isn't any code that deals with objects.
Sorry, @jwaltz, I didn't see this issue until now. There shouldn't be any need for the clean code to recurse into objects because it calls collapseObj first, which reduces nesting to one level. There might be a problem with the collapsing code, though. Can you post an example of an object that is not being typeconverted properly?
Using simple-schema v0.2.10
Simple-schema does not seem to be typeconverting some string values of a nested object into numbers/decimal numbers when I call clean. I was looking through the code of simple-schema.js and it's something in here:
If I understand correctly, looksLikeModifier(val) needs to be true in order to get to this line: } else if (_.isObject(opVal) && ("$each" in opVal)) { which I think is what would typeconvert the nested values? I don't really understand what the "$each" is except that opVal is the first argument to the iterator of the _.each call and represents the current element. http://underscorejs.org/#each
Some of the values i'm trying to convert include negative integers and negative decimals.
Let me know what you think and if i'm totally misunderstanding what's going on and doing something wrong.
The text was updated successfully, but these errors were encountered: