strict-attributes

1.0.1 • Public • Published

strict-attributes

Converts a plain object into an object that throws an error on try to read attributes that does not exist.

Example

// Port value will be "undefined" if environment variable not set and program will continue to run.
const port = process.env.PORT;
const strict = require('strict-attributes');
 
// Exception will be thrown if environment variable not set.
const port = strict(process.env).PORT; 

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i strict-attributes

    Weekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    1.95 kB

    Total Files

    4

    Last publish

    Collaborators

    • pldin601