https://github.com/animatedcreativity/node-sanitize-options
Combines any options passed by user with default options so that they are never undefined.
https://github.com/animatedcreativity/node-sanitize-options
Last synced: 4 months ago
JSON representation
Combines any options passed by user with default options so that they are never undefined.
- Host: GitHub
- URL: https://github.com/animatedcreativity/node-sanitize-options
- Owner: animatedcreativity
- License: mit
- Created: 2019-01-20T09:57:33.000Z (over 7 years ago)
- Default Branch: glitch
- Last Pushed: 2019-02-11T16:23:13.000Z (over 7 years ago)
- Last Synced: 2025-08-09T12:23:59.967Z (10 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-sanitize-options
Combines any options passed by user with default options so that they are never `undefined`.
Example:
```
var saveProduct = function(options) {
var sanitize = require("node-sanitize-options");
options = sanitize.options(options, {model: "ABC-001", price: 23.4, taxRate: 25, status: true});
console.log(options);
};
saveProduct({model: "XYZ-002", price: 70.24});
```
will output:
```
{
"model": "XYZ-002",
"price": 70.24,
"taxRate": 25,
"status": true
}
```