array-cbs
v1.0.0
Published
combinations array
Downloads
2
Readme
cbs
传入二维数组,返回二维数组的所有排列组合
安装
npm i cbs
测试
npm run test
使用
import cbs from 'cbs';
const arr = [
['黑色', '白色', '金色'],
['16G', '32G', '256G', '512G'],
['4.7', '5.5', '7.3'],
];
(async () => {
const res = await cbs(arr);
console.log('Input:', arr);
console.log('Output:', res);
})()
输出
[
[ '黑色', '16G', '4.7' ],
[ '白色', '16G', '4.7' ],
[ '金色', '16G', '4.7' ],
[ '黑色', '32G', '4.7' ],
[ '白色', '32G', '4.7' ],
[ '金色', '32G', '4.7' ],
[ '黑色', '256G', '4.7' ],
[ '白色', '256G', '4.7' ],
[ '金色', '256G', '4.7' ],
[ '黑色', '512G', '4.7' ],
[ '白色', '512G', '4.7' ],
[ '金色', '512G', '4.7' ],
[ '黑色', '16G', '5.5' ],
[ '白色', '16G', '5.5' ],
[ '金色', '16G', '5.5' ],
[ '黑色', '32G', '5.5' ],
[ '白色', '32G', '5.5' ],
[ '金色', '32G', '5.5' ],
[ '黑色', '256G', '5.5' ],
[ '白色', '256G', '5.5' ],
[ '金色', '256G', '5.5' ],
[ '黑色', '512G', '5.5' ],
[ '白色', '512G', '5.5' ],
[ '金色', '512G', '5.5' ],
[ '黑色', '16G', '7.3' ],
[ '白色', '16G', '7.3' ],
[ '金色', '16G', '7.3' ],
[ '黑色', '32G', '7.3' ],
[ '白色', '32G', '7.3' ],
[ '金色', '32G', '7.3' ],
[ '黑色', '256G', '7.3' ],
[ '白色', '256G', '7.3' ],
[ '金色', '256G', '7.3' ],
[ '黑色', '512G', '7.3' ],
[ '白色', '512G', '7.3' ],
[ '金色', '512G', '7.3' ]
]