JSPM

double-sort

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q35525F
  • License MIT

Sort an array on two object properties

Package Exports

  • double-sort

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

Readme

double-sort

Sort an array on two object properties

Install

$ npm install --save double-sort

Usage

const doubleSort = require('double-sort');

// sort by two object properties
doubleSort([{pending: 1, type: 'DEL'}, {pending: 2, type: 'HOLD'}, {pending, 3, type: 'DEL'}, ...], 'type', 'pending');
//=> [{pending: 3, type: 'DEL'}, {pending, 1, type: 'DEL'}, {pending: 2, type: 'HOLD'}, ...]

API

doubleSort(input, property1, property2)

Returns a new sorted array.

input

Type: Array

property1

Type: string

First parameter to be sorted on.

property2

Type: string

Second parameter to be sorted on. (property1 will always be respected first.)

License

MIT © Jack Hanford