JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 95
  • Score
    100M100P100Q71056F
  • License ISC

根据首拼音排序,获取数组,可用于城市筛选,用户筛选等

Package Exports

  • sort-word

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 (sort-word) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

sort-word

  npm install sort-word -S

use

第三参数为true时 添加热门项,默认添加传入数组前10个 不需要热门项,则不需要传第三个参数

  import SortWord from 'sort-word'

  let newList = new SortWord(list, value, true)

  例如:

  let arr = [{name: '张三'}, {name: '李四'}]
  let newArr = new SortWord(arr, 'name')

  newArr {
    newList:[
      {title: 'L', list: [{name: '李'}]},
      {title: 'Z', list: [{name: '张'}]}
    ],
    indexList: ['L', 'Z'],
    total: 2
  }