aboutsummaryrefslogtreecommitdiff
path: root/node_modules/passport-local/lib/utils.js
diff options
context:
space:
mode:
authornanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-21 06:29:31 +0000
committernanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-21 06:29:31 +0000
commitee8e1a13b60a6adfdc691b2a9b57289188397641 (patch)
tree096633208d9b8b6b59b67f4034a0cbb41e1f4c5d /node_modules/passport-local/lib/utils.js
parent689df70a38ace2f88cfef6ab50f10dc546b48f00 (diff)
need pull
Diffstat (limited to 'node_modules/passport-local/lib/utils.js')
-rw-r--r--node_modules/passport-local/lib/utils.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/node_modules/passport-local/lib/utils.js b/node_modules/passport-local/lib/utils.js
new file mode 100644
index 0000000..38f10a4
--- /dev/null
+++ b/node_modules/passport-local/lib/utils.js
@@ -0,0 +1,11 @@
+exports.lookup = function(obj, field) {
+ if (!obj) { return null; }
+ var chain = field.split(']').join('').split('[');
+ for (var i = 0, len = chain.length; i < len; i++) {
+ var prop = obj[chain[i]];
+ if (typeof(prop) === 'undefined') { return null; }
+ if (typeof(prop) !== 'object') { return prop; }
+ obj = prop;
+ }
+ return null;
+};