Skip to content
On this page

combine

combine 方法用来将多个数组内部的元素排列组合,列出所有的可能性

使用示例

ts
import { describe, expect, it } from 'vitest'
import combine from 'ufuse/src/utils/combine'

describe('combine', () => {
  it('基本使用', () => {
    expect(
      combine([2022, 2023], ['湖北省', '四川省'])).toEqual(
      [
        [2022, '湖北省'],
        [2022, '四川省'],
        [2023, '湖北省'],
        [2023, '四川省'],
      ],
    )
  })
})

贡献者

cuijin
xieyuhang