Skip to content

dtboy1995/sku-rank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sku-rank

🔥 a sku rank helper

install

npm i sku-rank

es6

import rank from 'sku-rank'

commonjs

const rank = require('sku-rank').default

usage

let data = [
    ['白色', '黑色', '灰色'],
    ['S', 'M', 'L'],
    ['真皮', '尼龙']
]
let ret = rank(data, 'item')
// return 
[ 
  [ '白色', 'S', '真皮' ],
  [ '白色', 'S', '尼龙' ],
  [ '白色', 'M', '真皮' ],
  [ '白色', 'M', '尼龙' ],
  [ '白色', 'L', '真皮' ],
  [ '白色', 'L', '尼龙' ],
  [ '黑色', 'S', '真皮' ],
  [ '黑色', 'S', '尼龙' ],
  [ '黑色', 'M', '真皮' ],
  [ '黑色', 'M', '尼龙' ],
  [ '黑色', 'L', '真皮' ],
  [ '黑色', 'L', '尼龙' ],
  [ '灰色', 'S', '真皮' ],
  [ '灰色', 'S', '尼龙' ],
  [ '灰色', 'M', '真皮' ],
  [ '灰色', 'M', '尼龙' ],
  [ '灰色', 'L', '真皮' ],
  [ '灰色', 'L', '尼龙' ]
]

mode

mode description sample
full (default) Return item and index [{ row: 1, column: 0, item: 'S' }]
index Only return index [1]
item Only return item ['S']

About

🔥 a sku rank helper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published