1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  | /** 
 |   * 打乱传入的数组 
 |   *  
 |   * @param {Array} array 待打乱的数组  
 |   */ 
 |  function random(array = []) { 
 |    return array.sort(() => Math.random() - 0.5) 
 |  } 
 |    
 |  /** 
 |   * 判断是否为数组 
 |   *  
 |   * @param {Object} arr 
 |   */ 
 |  function isArray(arr) { 
 |    return Object.prototype.toString.call(arr) === '[object Array]' 
 |  } 
 |    
 |  export default { 
 |    random, 
 |    isArray 
 |  } 
 |  
  |