JSPM

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

Package Exports

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

Readme

Build Status Coverage Status Known Vulnerabilities

fast-array-sort

Installation

npm install fast-array-sort

Params

sort(array, comparator);
  • array: The array to sort
  • comparator: Function to use for sorting

Usage

const sort = require("fast-array-sort");

sort([4, 2, 5, 1, 3]);
// [ 1, 2, 3, 4, 5 ]

const arr = [
  { order: 1, name: "apple" },
  { order: 5, name: "banana" },
  { order: 4, name: "candy" },
  { order: 2, name: "dollar" },
  { order: 3, name: "emit" },
];
sort(arr, (l, r) => l.order < r.order);
/*
[
  { order: 1, name: "apple" },
  { order: 2, name: "dollar" },
  { order: 3, name: "emit" },
  { order: 4, name: "candy" },
  { order: 5, name: "banana" },
]
*/