sortman

2.2.0 • Public • Published

SortMan

Sortman is sort lib in javascript.

Various sorting options are supported, including object sorting and switching between ascending and descending order.

Installation

npm install sortman

Usage

Please import sortman or sortman/tiny.

sortman/tiny was minified by terser

import { asc } from "sortman";

const data = [200, 300, 100];

const sorted = data.sort(asc);

console.log(sorted);

Usage (not default sort)

import { SortMan } from "sortman";

const data = [200, 300, 100];

const sorted = SortMan.sort(data);

console.log(sorted);
import { SortMan } from "sortman";

const data = [
	{
		i: 200
	},
	{
		i: 300
	},
	{
		i: 100
	}
];

const sorted = SortMan.sort(data, {
	func: (e) => e.i
});

console.log(sorted);

Support sorts

  • Bogo sort - SortMan.bogo
  • Bubble sort - SortMan.bubble
  • Bucket sort - SortMan.bucket
  • Comb sort - SortMan.comb
  • Gnome sort - SortMan.gnome
  • Heap sort - SortMan.heap
  • Insertion sort - SortMan.insertion
  • Merge sort - SortMan.merge
  • Quick sort - SortMan.quick
  • Selection sort - SortMan.selection
  • Shell sort - SortMan.shell

Options

Desc

By setting it to true, the output results will be in descending order.

import { SortMan } from "sortman";

const data = [200, 300, 100];

const sorted = SortMan.sort(data, {
	desc: true
});

console.log(sorted);

Repository

https://github.com/ROBOTofficial/sortman

Readme

Keywords

Package Sidebar

Install

npm i sortman

Weekly Downloads

80

Version

2.2.0

License

MIT

Unpacked Size

42.3 kB

Total Files

11

Last publish

Collaborators

  • robot_official