aboutsummaryrefslogtreecommitdiff
path: root/node_modules/object-visit/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-08-14 05:01:11 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-08-14 05:02:09 +0200
commit363723fc84f7b8477592e0105aeb331ec9a017af (patch)
tree29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/object-visit/index.js
parent5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff)
downloadwallet-core-363723fc84f7b8477592e0105aeb331ec9a017af.tar.xz
node_modules
Diffstat (limited to 'node_modules/object-visit/index.js')
-rw-r--r--node_modules/object-visit/index.js30
1 files changed, 30 insertions, 0 deletions
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 <https://github.com/jonschlinkert/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;
+};