1234567891011121314151617181920 |
- /**
- * get "nested" object property
- */
- function get(obj, prop){
- var parts = prop.split('.'),
- last = parts.pop();
- while (prop = parts.shift()) {
- obj = obj[prop];
- if (typeof obj !== 'object' || !obj) return;
- }
- return obj[last];
- }
- module.exports = get;
|