mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-30 17:27:22 +08:00
DISABLE_THIRD_PARTY_CHECK=new npm module causes package-lock change We can get rid of a custom script and use ESLint for these rules. Additionally this means editors will highlight the issue in the editor. Change-Id: I552b52e7f07b4e7430b3f685dbc3b5fad36ffff2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2052167 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
33 lines
757 B
JavaScript
33 lines
757 B
JavaScript
import _curry2 from './internal/_curry2.js';
|
|
|
|
/**
|
|
* Retrieve the value at a given path.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.2.0
|
|
* @category Object
|
|
* @typedefn Idx = String | Int
|
|
* @sig [Idx] -> {a} -> a | Undefined
|
|
* @param {Array} path The path to use.
|
|
* @param {Object} obj The object to retrieve the nested property from.
|
|
* @return {*} The data at `path`.
|
|
* @see R.prop
|
|
* @example
|
|
*
|
|
* R.path(['a', 'b'], {a: {b: 2}}); //=> 2
|
|
* R.path(['a', 'b'], {c: {b: 2}}); //=> undefined
|
|
*/
|
|
var path = /*#__PURE__*/_curry2(function path(paths, obj) {
|
|
var val = obj;
|
|
var idx = 0;
|
|
while (idx < paths.length) {
|
|
if (val == null) {
|
|
return;
|
|
}
|
|
val = val[paths[idx]];
|
|
idx += 1;
|
|
}
|
|
return val;
|
|
});
|
|
export default path; |