* Return `true` if the parameter is an Array * //TODO Replace this by the default `Array.isArray()` function? * * @param {*} arr * @throws Error * @returns {*|boolean}
(arr)
| 238 | * @returns {*|boolean} |
| 239 | */ |
| 240 | static isArray(arr) { |
| 241 | if (Object.prototype.toString.call([]) === '[object Array]') { // Make sure an array has a class attribute of [object Array] |
| 242 | // Test passed, now check if is an Array |
| 243 | return Array.isArray(arr) || (typeof arr === 'object' && Object.prototype.toString.call(arr) === '[object Array]'); |
| 244 | } |
| 245 | else { |
| 246 | throw new Error('toString message changed for Object Array'); // Verify that the string returned by `toString` does not change in the future (cf. http://stackoverflow.com/a/8365215) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * Return `true` if the parameter is a DOM element |
no outgoing calls
no test coverage detected