json-formula
json-formula copied to clipboard
Undocumented type behavior for hidden properties in `value` and `hasProperty`
Currently in the implementation of value and hasProperty, if there is a hidden property name in obj, type checking of arguments is ignored.
This is codified in these tests:
value(address.street, "$name")hasProperty(address.street, "$name")
It seems logical, that it would work that way (though I would still check, that name is a string), but it contradicts the current spec documentation.
I've updated the docs for value() and hasProperty(): https://github.com/adobe/json-formula/commit/4a9fd21a26123f179f166950a1ccc05b0858c5e4
I didn't bother to validate that the hidden property name was a string ... I suppose there's a very small chance that a non-string property parameter gets implicitly coerced to a hidden property name. But detecting that wasn't worth the extra code needed.