main
js 22 lines 675 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 import type {HookSourceLocationKey} from 'react-devtools-shared/src/frontend/types';
11 import type {HookSource} from 'react-debug-tools/src/ReactDebugHooks';
12
13 export function getHookSourceLocationKey({
14 fileName,
15 lineNumber,
16 columnNumber,
17 }: HookSource): HookSourceLocationKey {
18 if (fileName == null || lineNumber == null || columnNumber == null) {
19 throw Error('Hook source code location not found.');
20 }
21 return `${fileName}:${lineNumber}:${columnNumber}`;
22 }