JSPM

sku-rank

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q38554F
  • License MIT

a sku rank helper

Package Exports

  • sku-rank

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sku-rank) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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']