Hyperlinkv0.8.0-beta.28

Order

Order.Stringconsteffect/Order.ts:144
(self: string, that: string): Ordering

Order instance for strings that compares them lexicographically using JavaScript's < operator.

When to use

Use when you need lexicographic string ordering.

Details

Uses lexicographic dictionary ordering. The empty string is less than any non-empty string, and comparisons are case-sensitive.

Example (Ordering strings)

import { Order } from "effect"

console.log(Order.String("apple", "banana")) // -1
console.log(Order.String("banana", "apple")) // 1
console.log(Order.String("apple", "apple")) // 0
Source effect/Order.ts:1441 lines
export const String: Order<string> = make((self, that) => self < that ? -1 : 1)
Referenced by 1 symbols