Socket
Socket
Sign inDemoInstall

array-combination

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    array-combination

把数组排列组


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Install size
2.49 kB
Created
Weekly downloads
 

Readme

Source

array-combination

自由组合数组所有的可能 All the possibilities of a free combinatorial array

install

npm install --save array-combination

use

const arrayCombination = require('array-combination');

let optionList = {
  '姓名': [
    {name: '张三'},
    {name: '李四'},
  ],
  '年龄': [
    {age: '10-20'},
    {age: '20-30'},
  ],
  '其他': [
    {other: '是'},
    {other: '否'},
    {other: '1'},
  ],
};

let res = arrayCombination(optionList['姓名'], optionList['年龄'], optionList['其他']);
console.log(res);

// 输出 =>
[ [ { name: '张三' }, { age: '10-20' }, { other: '是' } ],
  [ { name: '张三' }, { age: '10-20' }, { other: '否' } ],
  [ { name: '张三' }, { age: '10-20' }, { other: '1' } ],
  [ { name: '张三' }, { age: '20-30' }, { other: '是' } ],
  [ { name: '张三' }, { age: '20-30' }, { other: '否' } ],
  [ { name: '张三' }, { age: '20-30' }, { other: '1' } ],
  [ { name: '李四' }, { age: '10-20' }, { other: '是' } ],
  [ { name: '李四' }, { age: '10-20' }, { other: '否' } ],
  [ { name: '李四' }, { age: '10-20' }, { other: '1' } ],
  [ { name: '李四' }, { age: '20-30' }, { other: '是' } ],
  [ { name: '李四' }, { age: '20-30' }, { other: '否' } ],
  [ { name: '李四' }, { age: '20-30' }, { other: '1' } ] ]

Keywords

FAQs

Last updated on 10 Jul 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc