I included the snippet only to highlight how, in the real world, ternaries are used to execute statements rather than simply express values. FWIW, in this case, the final `null` needs to be replaced with `factory(global)` to work as expected.
Indeed, “chained ternaries” is a better way to refer to them and I will start immediately.
From the article, “People try to use ternary statements as if they’re if statements. That doesn’t work, because ternary expressions are expressions, not statements”.
^ Actually, it does work with a little help from `||` or `&&`, which can and does lead to some logic errors.
Just today I put a PR on module with 500k daily installs, that broke it’s UMD wrapper due to an oversight surely from using “nested ternary statements”:
```
function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
? module.exports = factory(global)
: typeof define === 'function' && define.amd
? define(factory) : null
}
```
^ Muck
If you're not familiar with the Stylish extension, I recommend you check it out. It's great for making news and documentation sites easier on the glazzies.
I made this to personally use with the bookshelfjs orm. I convert express request[params,query,body] objects that use conventional camelCase keys to match db column names that use snake_case. I extend my models to use camelize for parsing db query outputs. It allows my models and db to use different and preferred naming conventions.
There are a bunch of string conversion modules but few I found focused on object keys, like I needed. Once I found them I wrapped them for convenience. I wouldn't be opposed to adding other cases, like: PascalCase, CONSTANT_CASE, ALLUPPERCASE, alllowercase, etc. but for those, I don't have a use case.. yet.