UNPKG

env-var

Version:

Verification, sanitization, and type coercion for environment variables in Node.js

10 lines (8 loc) 172 B
'use strict' module.exports = function asJson (value) { try { return JSON.parse(value) } catch (e) { throw new Error('should be valid (parseable) JSON') } }