0.2.0 • Published 4 years ago

@johnny.reina/chaos-sort v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Chaos Sort @johnny.reina/chaos-sort

Scrambles an array until it is sorted, then returns it

Why?

caption: yeah.
a scrampble function is a sort function if you run it enough times.
oh my god.
i have an idea.

Time Complexity

The sky's the limit.

Installation

npm i @johnny.reina/chaos-sort

Usage

import { chaosSort } from "@johnny.reina/chaos-sort";
const input = [
  { name: "Sam", age: 22 },
  { name: "Ed", age: 53 },
  { name: "Sally", age: 49 },
];
const actual = chaosSort(input, (x) => x.age);
// [
//   { name: "Sam", age: 22 },
//   { name: "Sally", age: 49 },
//   { name: "Ed", age: 53 },
// ]

Ord?

Ord as a convention is used to mean anything that can be ordered. In this case, strings, numbers, booleans, and Date objects can be ordered natiively in JavaScript.