marrus-sh / Alrescha

♓️🌟 An ECMAScript library for walking RDF graphs.
Creative Commons Zero v1.0 Universal
0 stars 0 forks source link

Validate datatypes and return .nominalValue when invalid #22

Open marrus-sh opened 4 years ago

marrus-sh commented 4 years ago

(This is not a priority.)

Ideally, Al·rishāʼ would validate the .nominalValue of a Literal before converting it using [Symbol.toPrimitive] or .valueOf(). If the .nominalValue is not in the lexical space for its .datatype, the string value of the .nominalValue should be returned instead. This would make it easy to check if a Literal is valid, by testing the return type of these functions.