1.0.1 • Published 10 months ago

order.ts v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Usage

import { compareUsing, prepareMatcher, searchUsing } from "order.ts";

const match = prepareMatcher("natural");

// Sorting
const byRelevanceTo = compareUsing(match);
["ab", "bc", "cd", "de"].sort(byRelevanceTo("c"));
// -> ['cd', 'bc', 'ab', 'de']

// Finding matches
const search = searchUsing(match, String);
search("c", ["ab", "bc", "cd", "de"]);
// -> ['cd', 'bc']
1.0.1

10 months ago

1.0.0

10 months ago