2 * get-value <https://github.com/jonschlinkert/get-value>
4 * Copyright (c) 2014-2015, Jon Schlinkert.
5 * Licensed under the MIT License.
8 module.exports = function(obj, prop, a, b, c) {
9 if (!isObject(obj) || !prop) {
13 prop = toString(prop);
15 // allowing for multiple properties to be passed as
16 // a string or array, but much faster (3-4x) than doing
17 // `[].slice.call(arguments)`
18 if (a) prop += '.' + toString(a);
19 if (b) prop += '.' + toString(b);
20 if (c) prop += '.' + toString(c);
26 var segs = prop.split('.');
27 var len = segs.length;
30 while (obj && (++i < len)) {
32 while (key[key.length - 1] === '\\') {
33 key = key.slice(0, -1) + '.' + segs[++i];
40 function isObject(val) {
41 return val !== null && (typeof val === 'object' || typeof val === 'function');
44 function toString(val) {
46 if (Array.isArray(val)) {