Detalhes do pacote

keysort

avoidwork206BSD-3-Clause3.0.1

Sorts an Array of Objects with SQL ORDER BY clause syntax

Array, Object, sort, keys

readme (leia-me)

keysort

Sorts an Array of Objects with SQL ORDER BY clause syntax.

Using the module

import {keysort} from "keysort";
const arr = [{abc: 123124, xyz: 5}, {abc: 123124, xyz: 6}, {abc: 2, xyz: 5}];

keysort(arr, "abc, xyz"); // [{abc: 2, xyz: 5}, {abc: 123124, xyz: 5}, {abc: 123124, xyz: 6}];
keysort(arr, "abc, xyz desc"); // [{abc: 2, xyz: 5}, {abc: 123124, xyz: 6}, {abc: 123124, xyz: 5}];

Testing

keysort has 100% code coverage with its tests.

-------------|---------|----------|---------|---------|-------------------
File         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------|---------|----------|---------|---------|-------------------
All files    |     100 |       80 |     100 |     100 |                  
 keysort.cjs |     100 |       80 |     100 |     100 | 25               
-------------|---------|----------|---------|---------|-------------------

API

keysort(arr = [], order = "", toSorted = false)

Sorts an Array of Objects with SQL ORDER BY clause syntax. If toSorted is true, a new sorted Array is returned.

License

Copyright (c) 2023 Jason Mulligan
Licensed under the BSD-3 license.

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by auto-changelog.

3.0.1

3.0.1

10 October 2023

  • Removing a copy/pasta error from package.json scripts & updating homepage 1ee176a
  • Generating CHANGELOG.md d2c1e15
  • Updating package.json keywords 94342ab

3.0.0

10 October 2023

  • Adding husky for precommit hook, updating build outputs, updating package.json, updating ignore files, adding third parameter toSorted = false to use Array.toSorted() to produce sorted clones, updating tests for 100% coverage, adding ./github, adding copilot generated tests (nested ones) a481233
  • Updating types & fixing .gitignore b19f26a
  • Updating types 112da1f

2.0.2

20 October 2022

  • Removing unneeded third parameter ebea4d1
  • Removing unneeded dev dependency d1abd17
  • Updating CHANGELOG.md a29102c

2.0.1

6 October 2022

  • Using string templates 982b3ba
  • Generating a CHANGELOG.md 95b3ab8
  • Building to update dist outputs 4bac2d4

2.0.0

6 October 2022

  • ES module syntax update #4
  • Changing to ES module syntax 709db00
  • Updating ignore files 0cc5195
  • Removing deprecated file 33d6f5e

1.0.2

23 February 2017

  • Updating IFFE argument, fixes #3 (i hope) #3

1.0.1

15 February 2017

1.0.0

15 February 2017

  • Initial refactor toward no try {} catch {}, updating build to use babel, switching to uglify for compression & using es6 syntax (WIP) 607053e
  • Removing old docs 9ee75ec
  • Generating better code 1891087

0.2.0

11 November 2014

  • Added deep sorting for dealing with variable shape Objects, fixes #2 #2

0.1.1

28 August 2013

  • Added case insensitive flag to asc replace e5559c9

0.1.0

28 August 2013