Skip to main content
Module

x/fun/string.ts>sort

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function sort
import { sort } from "https://deno.land/x/fun@v2.0.0/string.ts";

Compare two strings and return an Ordering (-1, 0, or 1);

Examples

Example 1

import { sort } from "./string.ts";

const result1 = sort("aa", "aa"); // 0
const result2 = sort("aa", "ab"); // -1
const result3 = sort("ba", "aa"); // 1
const result4 = sort("ab", "aa"); // 1
const result5 = sort("a", "aa"); // -1

Parameters

first: string
second: string