Skip to content

pyldin601/strict-attributes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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; 

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published