(haystack, needle)
| 348 | |
| 349 | // Utility for checking whether an object contains another object |
| 350 | function includes (haystack, needle) { |
| 351 | /* jshint maxdepth: 3*/ |
| 352 | var i; |
| 353 | |
| 354 | // Array#indexOf, but ie... |
| 355 | if (isArray(haystack)) { |
| 356 | for (i = haystack.length - 1; i >= 0; i = i - 1) { |
| 357 | if (haystack[i] === needle) { |
| 358 | return true; |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | // String#indexOf |
| 364 | if (typeof haystack === 'string') { |
| 365 | if (haystack.indexOf(needle) !== -1) { |
| 366 | return true; |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | // Object#hasOwnProperty |
| 371 | if (isPlainObject(haystack)) { |
| 372 | if (haystack.hasOwnProperty(needle)) { |
| 373 | return true; |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | return false; |
| 378 | } |
| 379 | |
| 380 | // Utility for checking whether a value is an array |
| 381 | var isArray = Array.isArray || function (val) { |
no test coverage detected