normalize-options.js 387 B

1234567891011121314151617
  1. 'use strict';
  2. var forEach = Array.prototype.forEach, create = Object.create;
  3. var process = function (src, obj) {
  4. var key;
  5. for (key in src) obj[key] = src[key];
  6. };
  7. module.exports = function (options/*, …options*/) {
  8. var result = create(null);
  9. forEach.call(arguments, function (options) {
  10. if (options == null) return;
  11. process(Object(options), result);
  12. });
  13. return result;
  14. };