MCPcopy Index your code
hub / github.com/immutable-js/immutable-js / coerceKeyPath

Function coerceKeyPath

src/utils/coerceKeyPath.ts:5–15  ·  view source on GitHub ↗
(keyPath: KeyPath<K>)

Source from the content-addressed store, hash-verified

3import isArrayLike from './isArrayLike';
4
5export default function coerceKeyPath<K>(keyPath: KeyPath<K>): ArrayLike<K> {
6 if (isArrayLike(keyPath) && typeof keyPath !== 'string') {
7 return keyPath;
8 }
9 if (isOrdered(keyPath)) {
10 return keyPath.toArray();
11 }
12 throw new TypeError(
13 'Invalid keyPath: expected Ordered Collection or Array: ' + keyPath
14 );
15}

Callers 2

updateInFunction · 0.85
getInFunction · 0.85

Calls 3

isOrderedFunction · 0.90
isArrayLikeFunction · 0.85
toArrayMethod · 0.65

Tested by

no test coverage detected