(keyPath: KeyPath<K>)
| 3 | import isArrayLike from './isArrayLike'; |
| 4 | |
| 5 | export 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 | } |
no test coverage detected