5 ms·
Typescript has a lot of punctuation and thus it's not really human-editable. I'd prefer a ini-style format or dockerfile style (with one directive per line of
by enriquto 5y ago
Typescript has a lot of punctuation and thus it's not really human-editable. I'd prefer a ini-style format or dockerfile style (with one directive per line of text, clearly identified by a single uppercase word). Moreover, these formats are so easy to parse that you do not even need a library to do so.
- ComputerGuru 5y agoExcept there’s the ini where strings need to be quoted and the one where they don’t. The one where white space is allowed after the equal sign and the one where it’s not. The one where keys are case sensitive and the one where they’re not. TOML cleans up most of that, though.
- tomtheelder 5y agoI'm puzzled what you mean by this. Do you mean it's not easily editable by non-engineers?
- enriquto 5y agoIt's annoying to edit by everybody. I guess engineers will especially abhor the unnecessary complexity. This is the proposal of TFA: export const config: MyAppConfig = { locale: 'en-US', timezone: 'America/New_York', logLevel: 'info', environment: 'local', } And this is how simple it could be: LOCALE en-US TIMEZONE America/New_York LOGLEVEL info ENVIRONMENT local The first version has 19 useless punctuation symbols and a few spurious words that are not related to the configuration itself, but are constraints of the typescript implementation. The second version is much simpler, easier to write and to parse using trivial string processing, without depending on any third-party library. It is beyond me how could any serious engineer honestly find any advantage in the first version.
- aldonius 5y agoWell, if you want nesting on your map then you need something slightly more complicated than your second version, but I will grant that you could do something like: A.B value C value D.E.F value D.E.G value