jq icon indicating copy to clipboard operation
jq copied to clipboard

Strict mode for undefined properties

Open joelpurra opened this issue 11 years ago • 13 comments

After spending an hour hunting down a bug, I thought of something. How about a strict mode, where you can't read absent properties without an error?

I'm thinking of a property like .b in this example object, which would throw an error if read:

{
    "a": 1,
    "c": 3
}

(Exactly, there is no spoon, errr, I mean.b.)

The specific problem I had just now, was that an object was being passed around different functions, but in one of the places a .propertyName was referenced differently cased .propertyname. No errors, which is understandable and acceptable - but annoying, and in the long run, possibly error prone.

Thoughts?

joelpurra avatar Aug 08 '14 13:08 joelpurra