safeget 🛡
V1.0
Super simple NPM module which allows to safely unwrap complex JSON files and provide default value in case of failure
Build Setup
In order to add safeget to your project, run:
npm i safeget-json
You can use safeget by passing JSON as a result of an anonymous function + default value as follows:
const safeget = const really = what: can: go: wrong: '?' const core =
If JSON contains required node, it will be retrieved. In case node doesn't exist, defauls value ('stub!' in example) will be assigned instead.
Feel free to contribute!