* Generate a key string that identifies a element within a set. * * @param {*} element A element that could contain a manual key. * @param {number} index Index that is used if a manual key is not provided. * @return {string}
(element: any, index: number)
| 70 | * @return {string} |
| 71 | */ |
| 72 | function getElementKey(element: any, index: number): string { |
| 73 | class="cm">// Do some typechecking here since we call this blindly. We want to ensure |
| 74 | class="cm">// that we don't block potential future ES APIs. |
| 75 | if (typeof element === class="st">'object' && element !== null && element.key != null) { |
| 76 | class="cm">// Explicit key |
| 77 | if (__DEV__) { |
| 78 | checkKeyStringCoercion(element.key); |
| 79 | } |
| 80 | return escape(class="st">'' + element.key); |
| 81 | } |
| 82 | class="cm">// Implicit key determined by the index in the set |
| 83 | return index.toString(36); |
| 84 | } |
| 85 | |
| 86 | function resolveThenable<T>(thenable: Thenable<T>): T { |
| 87 | switch (thenable.status) { |
no test coverage detected