From 363723fc84f7b8477592e0105aeb331ec9a017af Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Aug 2017 05:01:11 +0200 Subject: node_modules --- node_modules/object-visit/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 node_modules/object-visit/index.js (limited to 'node_modules/object-visit/index.js') diff --git a/node_modules/object-visit/index.js b/node_modules/object-visit/index.js new file mode 100644 index 000000000..50b5800e7 --- /dev/null +++ b/node_modules/object-visit/index.js @@ -0,0 +1,30 @@ +/*! + * object-visit + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var isObject = require('isobject'); + +module.exports = function visit(thisArg, method, target) { + if (!isObject(thisArg) && typeof thisArg !== 'function') { + throw new Error('object-visit expects `thisArg` to be an object.'); + } + + if (typeof method !== 'string') { + throw new Error('object-visit expects `method` name to be a string'); + } + + if (typeof thisArg[method] !== 'function') { + return thisArg; + } + + target = target || {}; + for (var key in target) { + thisArg[method](key, target[key]); + } + return thisArg; +}; -- cgit v1.2.3