adobe / json-formula

Query language for JSON documents
http://opensource.adobe.com/json-formula/
Apache License 2.0
19 stars 8 forks source link

Undocumented type behavior for hidden properties in `value` and `hasProperty` #182

Open Eswcvlad opened 1 month ago

Eswcvlad commented 1 month ago

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:

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.

JohnBrinkman commented 1 month ago

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.