You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
352 B
22 lines
352 B
/**
|
|
* 打乱传入的数组
|
|
*
|
|
* @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
|
|
}
|