mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
338 B
16 lines
338 B
10 years ago
|
'use strict';
|
||
|
|
||
|
var value = require('./valid-value');
|
||
|
|
||
|
module.exports = function (obj/*, …names*/) {
|
||
|
var length, current = 1;
|
||
|
value(obj);
|
||
|
length = arguments.length - 1;
|
||
|
if (!length) return obj;
|
||
|
while (current < length) {
|
||
|
obj = obj[arguments[current++]];
|
||
|
if (obj == null) return undefined;
|
||
|
}
|
||
|
return obj[arguments[current]];
|
||
|
};
|