(obj: unknown)
| 166 | @public |
| 167 | */ |
| 168 | export function isArray(obj: unknown): obj is ArrayLike<unknown> | EmberArray<unknown> { |
| 169 | if (DEBUG && typeof obj === 'object' && obj !== null) { |
| 170 | // SAFETY: Property read checks are safe if it's an object |
| 171 | let possibleProxyContent = (obj as any)[PROXY_CONTENT]; |
| 172 | if (possibleProxyContent !== undefined) { |
| 173 | obj = possibleProxyContent; |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | // SAFETY: Property read checks are safe if it's an object |
| 178 | if (!obj || (obj as any).setInterval) { |
| 179 | return false; |
| 180 | } |
| 181 | |
| 182 | if (Array.isArray(obj) || EmberArray.detect(obj)) { |
| 183 | return true; |
| 184 | } |
| 185 | |
| 186 | let type = typeOf(obj); |
| 187 | if ('array' === type) { |
| 188 | return true; |
| 189 | } |
| 190 | |
| 191 | // SAFETY: Property read checks are safe if it's an object |
| 192 | let length = (obj as any).length; |
| 193 | if (typeof length === 'number' && length === length && 'object' === type) { |
| 194 | return true; |
| 195 | } |
| 196 | |
| 197 | return false; |
| 198 | } |
| 199 | |
| 200 | /* |
| 201 | This allows us to define computed properties that are not enumerable. |
no test coverage detected