Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pyldin601/strict-attributes

Converts a plain object into an object that throws error on try to read attributes that does not exist.
https://github.com/pyldin601/strict-attributes

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

# strict-attributes

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

## Example
```javascript
// Port value will be "undefined" if environment variable not set and program will continue to run.
const port = process.env.PORT;
```

```javascript
const strict = require('strict-attributes');

// Exception will be thrown if environment variable not set.
const port = strict(process.env).PORT;
```