merge_options.js 348 B

12345678910111213
  1. 'use strict';
  2. module.exports = function mergeOptions(defaults, options) {
  3. options = options || Object.create(null);
  4. return [defaults, options].reduce(function (merged, optObj) {
  5. Object.keys(optObj).forEach(function (key) {
  6. merged[key] = optObj[key];
  7. });
  8. return merged;
  9. }, Object.create(null));
  10. };