测试

安装步骤

测试

  1. 这是1
  2. 这是2

小细节

分支步骤

const safeGet = (data, path) => {
  if(!path) return undefined;
  const pathArr = path.split('.');
  let result = data;
  let length = pathArr.length
  while(length--) {
    const iter = pathArr.shift();
    result = result[iter];
    if(result === undefined) return undefined;
  }
  return result
}
原文地址:https://www.cnblogs.com/shineyao/p/7471554.html