Str.byCodePoint
function · packages/metakit/src/ops/str.ts:123
function byCodePoint(a: string, b: string): number-1, 0 or 1 as a is before, at or after b by code point, which UTF-16 order is not.
Metakit / @doeixd/metakit
namespace · packages/metakit/src/ops/str.ts:12
export * as Str from './ops/str.js'String primitives (str.len, str.startsWith, str.contains,
str.lowerAscii, str.trim, the code-point orders str.lt, str.lte,
str.gt, str.gte) and derived helper (Str.isEmpty). Null-strict: a null string gives null, and text
holding a NUL character is refused (unportable), before null.
str.len counts Unicode code points ([...s].length) so JavaScript,
Postgres (char_length), and SQLite (length) agree identically on
surrogate pairs and emoji. Text is compared by character, as a database
holds it: a lone surrogate, which UTF-8 cannot encode, reads as U+FFFD.
Str.byCodePointfunction · packages/metakit/src/ops/str.ts:123
function byCodePoint(a: string, b: string): number-1, 0 or 1 as a is before, at or after b by code point, which UTF-16 order is not.
Str.codePointLengthfunction · packages/metakit/src/ops/str.ts:22
function codePointLength(s: string): numberCount Unicode code points in s (matches Postgres char_length and SQLite length).
Str.concatfunction · packages/metakit/src/ops/str.ts:185
function concat<A extends NullableText, B extends NullableText>(
left: A,
right: B,
): Expr<EnvOfInput<A> & EnvOfInput<B>, string | NullOf<A> | NullOf<B>>Concatenate two strings.
Str.concatOpconst · packages/metakit/src/ops/str.ts:103
const concatOp = { id, returns, nulls, refuses, evaluate }Str.containsfunction · packages/metakit/src/ops/str.ts:168
function contains<S extends NullableText, Sub extends NullableText>(
value: S,
substring: Sub,
): Expr<EnvOfInput<S> & EnvOfInput<Sub>, boolean | NullOf<S> | NullOf<Sub>>True when value contains substring.
Str.containsOpconst · packages/metakit/src/ops/str.ts:75
const containsOp = { id, returns, nulls, refuses, evaluate }Str.endsWithfunction · packages/metakit/src/ops/str.ts:161
function endsWith<S extends NullableText, P extends NullableText>(
value: S,
suffix: P,
): Expr<EnvOfInput<S> & EnvOfInput<P>, boolean | NullOf<S> | NullOf<P>>True when value ends with suffix.
Str.endsWithOpconst · packages/metakit/src/ops/str.ts:67
const endsWithOp = { id, returns, nulls, refuses, evaluate }Str.gtconst · packages/metakit/src/ops/str.ts:205
const gt: TextOrderleft sorts after right by code point.
Str.gteconst · packages/metakit/src/ops/str.ts:207
const gte: TextOrderleft sorts after right, or is it, by code point.
Str.gteOpconst · packages/metakit/src/ops/str.ts:147
const gteOp: Node.Op<'str.gte'>Str.gtOpconst · packages/metakit/src/ops/str.ts:146
const gtOp: Node.Op<'str.gt'>Str.isEmptyfunction · packages/metakit/src/ops/str.ts:210
function isEmpty<S extends NullableText>(value: S): Expr<EnvOfInput<S>, boolean>Derived helper: Eq.is(Str.len(s), 0); false for a null string, whose length is null.
Str.lenfunction · packages/metakit/src/ops/str.ts:150
function len<S extends NullableText>(
value: S,
): Expr<EnvOfInput<S>, number | NullOf<S>>Unicode code-point length of a string (always >= 0).
Str.lenOpconst · packages/metakit/src/ops/str.ts:50
const lenOp = { id, returns, nulls, refuses, evaluate }Str.lowerAsciifunction · packages/metakit/src/ops/str.ts:175
function lowerAscii<S extends NullableText>(
value: S,
): Expr<EnvOfInput<S>, string | NullOf<S>>value with A to Z lowered and every other character kept: no locale's casing.
Str.lowerAsciiOpconst · packages/metakit/src/ops/str.ts:83
const lowerAsciiOp = { id, returns, nulls, refuses, evaluate }Str.ltconst · packages/metakit/src/ops/str.ts:201
const lt: TextOrderleft sorts before right by code point (a database's binary, or COLLATE "C", order).
Str.lteconst · packages/metakit/src/ops/str.ts:203
const lte: TextOrderleft sorts before right, or is it, by code point.
Str.lteOpconst · packages/metakit/src/ops/str.ts:145
const lteOp: Node.Op<'str.lte'>Str.ltOpconst · packages/metakit/src/ops/str.ts:144
const ltOp: Node.Op<'str.lt'>Str.NullableTexttype · packages/metakit/src/ops/str.ts:19
type NullableText = ExprInput<never, string | null>A text operand; where it may be null, so may the result.
Str.startsWithfunction · packages/metakit/src/ops/str.ts:154
function startsWith<S extends NullableText, P extends NullableText>(
value: S,
prefix: P,
): Expr<EnvOfInput<S> & EnvOfInput<P>, boolean | NullOf<S> | NullOf<P>>True when value begins with prefix.
Str.startsWithOpconst · packages/metakit/src/ops/str.ts:59
const startsWithOp = { id, returns, nulls, refuses, evaluate }Str.trimfunction · packages/metakit/src/ops/str.ts:192
function trim<S extends NullableText>(
value: S,
): Expr<EnvOfInput<S>, string | NullOf<S>>value without leading or trailing space, tab, line feed or carriage return.
Str.trimOpconst · packages/metakit/src/ops/str.ts:114
const trimOp = { id, returns, nulls, refuses, evaluate }Str.upperAsciifunction · packages/metakit/src/ops/str.ts:180
function upperAscii<S extends NullableText>(
value: S,
): Expr<EnvOfInput<S>, string | NullOf<S>>value with a to z upper-cased and every other character kept: no locale's casing.
Str.upperAsciiOpconst · packages/metakit/src/ops/str.ts:93
const upperAsciiOp = { id, returns, nulls, refuses, evaluate }Str.wellFormedfunction · packages/metakit/src/nodeOps.ts:108
function wellFormed(text: string): stringtext as SQLite's and Postgres's drivers hold it: each lone surrogate as U+FFFD.