Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/pyldin601/strict-attributes
- Owner: pyldin601
- Created: 2018-02-09T15:32:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T14:27:39.000Z (about 1 year ago)
- Last Synced: 2024-12-08T22:00:13.908Z (about 2 months ago)
- Language: JavaScript
- Size: 39.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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;
```