denoland/std

Reconsider value parsing of `std/ini`

kt3k opened this issue · 0 comments

kt3k commented

Currently the parser parses all values into string, but the existing parsers in the ecosystem often work in a different way.

  • npm:ini
    • parses true false into booleans
    • no handling for numbers
    • strips double quotes when they are balanced. (no stripping happens if quotes are not balanced)
    • also supports array in the form of array[] = value
  • python configparser std module
    • parses all values into string by default
    • optionally you can call getboolean to covert value into boolean (many things are considered boolean such as true/false, yes/no, on/off, 1/0)
    • no quote stripping
  • parse_ini_string builtin function in php
    • handles TRUE FALSE as booleans
    • strips quotes around the value. Errors at unbalanced quotes.

(Further investigations of other parsers are welcome)

There seem no consensus in value handling, it might make sense to follow npm:ini when there's differences.