mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-15 02:55:08 +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>
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
var _curry1 = /*#__PURE__*/require('./internal/_curry1');
|
|
|
|
var keys = /*#__PURE__*/require('./keys');
|
|
|
|
/**
|
|
* Returns a new object with the keys of the given object as values, and the
|
|
* values of the given object, which are coerced to strings, as keys. Note
|
|
* that the last key found is preferred when handling the same value.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.9.0
|
|
* @category Object
|
|
* @sig {s: x} -> {x: s}
|
|
* @param {Object} obj The object or array to invert
|
|
* @return {Object} out A new object
|
|
* @see R.invert
|
|
* @example
|
|
*
|
|
* const raceResults = {
|
|
* first: 'alice',
|
|
* second: 'jake'
|
|
* };
|
|
* R.invertObj(raceResults);
|
|
* //=> { 'alice': 'first', 'jake':'second' }
|
|
*
|
|
* // Alternatively:
|
|
* const raceResults = ['alice', 'jake'];
|
|
* R.invertObj(raceResults);
|
|
* //=> { 'alice': '0', 'jake':'1' }
|
|
*/
|
|
|
|
|
|
var invertObj = /*#__PURE__*/_curry1(function invertObj(obj) {
|
|
var props = keys(obj);
|
|
var len = props.length;
|
|
var idx = 0;
|
|
var out = {};
|
|
|
|
while (idx < len) {
|
|
var key = props[idx];
|
|
out[obj[key]] = key;
|
|
idx += 1;
|
|
}
|
|
return out;
|
|
});
|
|
module.exports = invertObj; |