Skip to content

Commit

Permalink
Core: Make internal inArray use Array.prototype.includes when possible
Browse files Browse the repository at this point in the history
Closes #1695.
  • Loading branch information
izelnakri authored Jan 24, 2023
1 parent 4ef04c1 commit b126734
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ export function diff (a, b) {
* @param {Array} array
* @return {boolean}
*/
export function inArray (elem, array) {
return array.indexOf(elem) !== -1;
}
export const inArray = Array.prototype.includes
? (elem, array) => array.includes(elem)
: (elem, array) => array.indexOf(elem) !== -1;

/**
* Recursively clone an object into a plain array or object, taking only the
Expand Down

0 comments on commit b126734

Please sign in to comment.