morgan-utils Utitlity library 安全取值: 安全取出对象中的某个属性 在获取对象一个深层的属性时,必须保证它的上一级不为undefined; 为了不让程序崩溃,抽象出一个安全取值的方法; 常规: props.user && props.user.posts && props.user.posts.comments 使用utils: import { safeGet } from 'morgan-utils'; safeGet(data: Object, pathValue: ?string)