abbott-methods
Version:
abbott,methods,method,functions,function
19 lines (18 loc) • 431 B
text/typescript
/**
* @description 迪卡尔积
* @example arrayDiKaErJi([1,2,3],[1,2,3],[1,2,3])
* @returns {[]}
*/
export const arrayDiKaErJi = (...arrayAny: any[]): any[] =>
arrayAny.reduce(
(total: any, current: any) => {
const ret = [] as any[]
total.forEach((a: any) => {
current.forEach((b: any) => {
ret.push(a.concat([b]))
})
})
return ret
},
[[]]
)