项目原始demo,不改动
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
To repozytorium jest zarchiwizowane. Możesz wyświetlać pliki i je sklonować, ale nie możesz do niego przepychać zmian lub otwierać zgłoszeń/Pull Requestów.
 
 
 
 

34 wiersze
806 B

  1. /*!
  2. * object-visit <https://github.com/jonschlinkert/object-visit>
  3. *
  4. * Copyright (c) 2015, 2017, Jon Schlinkert.
  5. * Released under the MIT License.
  6. */
  7. 'use strict';
  8. var isObject = require('isobject');
  9. module.exports = function visit(thisArg, method, target, val) {
  10. if (!isObject(thisArg) && typeof thisArg !== 'function') {
  11. throw new Error('object-visit expects `thisArg` to be an object.');
  12. }
  13. if (typeof method !== 'string') {
  14. throw new Error('object-visit expects `method` name to be a string');
  15. }
  16. if (typeof thisArg[method] !== 'function') {
  17. return thisArg;
  18. }
  19. var args = [].slice.call(arguments, 3);
  20. target = target || {};
  21. for (var key in target) {
  22. var arr = [key, target[key]].concat(args);
  23. thisArg[method].apply(thisArg, arr);
  24. }
  25. return thisArg;
  26. };