10 lines
251 B
JavaScript
10 lines
251 B
JavaScript
export default function get(entity, path) {
|
|
var current = entity;
|
|
for (var i = 0; i < path.length; i += 1) {
|
|
if (current === null || current === undefined) {
|
|
return undefined;
|
|
}
|
|
current = current[path[i]];
|
|
}
|
|
return current;
|
|
} |