File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,18 +47,6 @@ export function diff (a, b) {
4747 return a . filter ( ( a ) => b . indexOf ( a ) === - 1 ) ;
4848}
4949
50- /**
51- * Determines whether an element exists in a given array or not.
52- *
53- * @method inArray
54- * @param {any } elem
55- * @param {Array } array
56- * @return {boolean }
57- */
58- export function inArray ( elem , array ) {
59- return array . indexOf ( elem ) !== - 1 ;
60- }
61-
6250/**
6351 * Recursively clone an object into a plain array or object, taking only the
6452 * own enumerable properties.
Original file line number Diff line number Diff line change 2929// -------
3030
3131import config from './core/config' ;
32- import { inArray , toString , is } from './core/utilities' ;
32+ import { toString , is } from './core/utilities' ;
3333
3434export default ( function ( ) {
3535 function quote ( str ) {
@@ -222,7 +222,7 @@ export default (function () {
222222 const nonEnumerableProperties = [ 'message' , 'name' ] ;
223223 for ( const i in nonEnumerableProperties ) {
224224 const key = nonEnumerableProperties [ i ] ;
225- if ( key in map && ! inArray ( key , keys ) ) {
225+ if ( key in map && ! keys . includes ( key ) ) {
226226 keys . push ( key ) ;
227227 }
228228 }
Original file line number Diff line number Diff line change 1- import { inArray } from './core/utilities' ;
2-
31const LISTENERS = Object . create ( null ) ;
42const SUPPORTED_EVENTS = [
53 'error' ,
@@ -50,7 +48,7 @@ export function emit (eventName, data) {
5048export function on ( eventName , callback ) {
5149 if ( typeof eventName !== 'string' ) {
5250 throw new TypeError ( 'eventName must be a string when registering a listener' ) ;
53- } else if ( ! inArray ( eventName , SUPPORTED_EVENTS ) ) {
51+ } else if ( ! SUPPORTED_EVENTS . includes ( eventName ) ) {
5452 const events = SUPPORTED_EVENTS . join ( ', ' ) ;
5553 throw new Error ( `"${ eventName } " is not a valid event; must be one of: ${ events } .` ) ;
5654 } else if ( typeof callback !== 'function' ) {
@@ -62,7 +60,7 @@ export function on (eventName, callback) {
6260 }
6361
6462 // Don't register the same callback more than once
65- if ( ! inArray ( callback , LISTENERS [ eventName ] ) ) {
63+ if ( ! LISTENERS [ eventName ] . includes ( callback ) ) {
6664 LISTENERS [ eventName ] . push ( callback ) ;
6765 }
6866}
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import {
1111 extend ,
1212 generateHash ,
1313 hasOwn ,
14- inArray ,
1514 performance
1615} from './core/utilities' ;
1716import { runLoggingCallbacks } from './core/logging' ;
@@ -805,7 +804,7 @@ Test.prototype = {
805804 return (
806805 // undefined or empty array
807806 ! selectedId || ! selectedId . length ||
808- inArray ( testModule . moduleId , selectedId ) || (
807+ selectedId . includes ( testModule . moduleId ) || (
809808 testModule . parentModule && moduleChainIdMatch ( testModule . parentModule , selectedId )
810809 )
811810 ) ;
@@ -815,7 +814,7 @@ Test.prototype = {
815814 return false ;
816815 }
817816
818- if ( config . testId && config . testId . length && ! inArray ( this . testId , config . testId ) ) {
817+ if ( config . testId && config . testId . length && ! config . testId . includes ( this . testId ) ) {
819818 return false ;
820819 }
821820
You can’t perform that action at this time.
0 commit comments