判断数组是否所有项满足指定的类型或判断条件
待检测的值
类型字符串或断言函数
是否所有元素满足条件
arrayIsEvery(['a', 'b'], 'string'); // truearrayIsEvery([1, 2, 3], (x): x is number => typeof x === 'number'); // truearrayIsEvery([{ id: 1 }], item => typeof item === 'object'); // true Copy
arrayIsEvery(['a', 'b'], 'string'); // truearrayIsEvery([1, 2, 3], (x): x is number => typeof x === 'number'); // truearrayIsEvery([{ id: 1 }], item => typeof item === 'object'); // true
判断数组是否所有项满足指定的类型或判断条件