mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-05 05:29:01 +08:00
14 lines
281 B
TypeScript
14 lines
281 B
TypeScript
export default function get(entity: any, path: (string | number)[]) {
|
|
let current = entity;
|
|
|
|
for (let i = 0; i < path.length; i += 1) {
|
|
if (current === null || current === undefined) {
|
|
return undefined;
|
|
}
|
|
|
|
current = current[path[i]];
|
|
}
|
|
|
|
return current;
|
|
}
|