Created
March 13, 2019 09:02
-
-
Save wxingheng/2f26889c4562e62ae4487ff76009f001 to your computer and use it in GitHub Desktop.
通用方法汇总 getV 方法 函数
手机通用方法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ```language | |
| /** | |
| * getV(init, obj, 'children', 'children' ...) | |
| * @param init args | |
| * @returns {any} | |
| */ | |
| const getV = (init, ...args) => args.length >=2 ? args.reduce((a, b) => a && a.hasOwnProperty(b) ? a[b]: init) : init | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment