datacore icon indicating copy to clipboard operation
datacore copied to clipboard

camelCase prop values invalid?

Open zanodor opened this issue 1 year ago • 2 comments

Was fooling around with datacorejsx (as a user, not a dev) and found that snake_case date property values were handled fine, but camelCase came up undefined in the console.

zanodor avatar Nov 13 '24 17:11 zanodor

I noticed too that I could only access my properties when querying them in small case, even though they were in camelCase in the actual note.

Then I realized that was because I was accessing them like this: note.$frontmatter?.key?.value, instead of the expected syntax: note.value("key"). It is case-insensitive, you can do either note.value("tagName") or note.value("tagname").

beesinblenders avatar Feb 13 '25 10:02 beesinblenders

the expected syntax: note.value("key")

Yes, both page.value("key") and note.value("key") work.

The only place replacing these didn't work was where I had functions that handle dynamic property access. So I wasn't able to change these without breaking functionality:

  • any instance of $frontmatter?.[property]
  • any instance of $frontmatter?.['property']

zanodor avatar Feb 13 '25 20:02 zanodor