Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Note value of failed <string>.as("Number")

...

Info
titleEngine Compatibility

In the node pico engine, the target types for the as() function and the results returned from the typeof() function are these values:

  • "Array"

  • "Boolean"

  • "Map"

  • "Null"

  • "Number"

  • "RegExp"

  • "String"


The following coercions are valid:

  • Strings can be coerced to numbers (0 on failure) and regular expressions.
  • Numbers can be coerced to strings.
  • Regular expressions can be coerced to strings.
  • Any expression can be coerced to Boolean.

An error is thrown for other attempted coercions, unless the value being coerced by as() is already of the target type.

...