MCPcopy Create free account
hub / github.com/react-component/select / getKey

Function getKey

src/utils/valueUtil.ts:6–21  ·  view source on GitHub ↗
(data: BaseOptionType, index: number)

Source from the content-addressed store, hash-verified

4import type { FlattenOptionData } from '../interface';
5
6function getKey(data: BaseOptionType, index: number) {
7 const { key } = data;
8 let value: RawValueType;
9
10 if ('value' in data) {
11 ({ value } = data);
12 }
13
14 if (key !== null && key !== undefined) {
15 return key;
16 }
17 if (value !== undefined) {
18 return value;
19 }
20 return `rc-index-key-${index}`;
21}
22
23export function isValidCount(value?: number) {
24 return typeof value !== 'undefined' && !Number.isNaN(value);

Callers 1

digFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…