merge-options.js 334 B

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