From b0481df81d71566464823b7022d3ab54bef4c51f Mon Sep 17 00:00:00 2001 From: "soya.miruku" Date: Thu, 23 Nov 2023 15:54:08 +0000 Subject: [PATCH] fe --- project.json | 2 +- src/functions/strings.ts | 59 ++++++++++++++++++++-------------------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/project.json b/project.json index 667ceb0..3dca8ab 100644 --- a/project.json +++ b/project.json @@ -1,4 +1,4 @@ { "name": "@soyamiruku/typed-surql", - "version": "1.0.23" + "version": "1.0.24" } \ No newline at end of file diff --git a/src/functions/strings.ts b/src/functions/strings.ts index 375cdf3..b82e80d 100644 --- a/src/functions/strings.ts +++ b/src/functions/strings.ts @@ -1,118 +1,119 @@ import { parseType, qlFn } from "./index.ts" -export function concat(...args: string[]) { +type Input = string | qlFn +export function concat(...args: Input[]) { return qlFn.create(`string::concat(${args.map(s => `"${s}"`).join(",")})`) } -export function contains(value: string, search: string) { +export function contains(value: Input, search: Input) { return qlFn.create(`string::contains(${parseType(value)},"${search}")`) } -export function endsWith(value: string, search: string) { +export function endsWith(value: Input, search: Input) { return qlFn.create(`string::endsWith(${parseType(value)},"${search}")`) } -export function join(value: string, ...others: string[]) { +export function join(value: Input, ...others: Input[]) { return qlFn.create(`string::join(${parseType(value)},${others.map(s => `"${s}"`).join(",")})`) } -export function len(value: string) { +export function len(value: Input) { return qlFn.create(`string::len(${parseType(value)})`) } -export function lowercase(value: string) { +export function lowercase(value: Input) { return qlFn.create(`string::lowercase(${parseType(value)})`) } -export function repeat(value: string, count: number) { +export function repeat(value: Input, count: number) { return qlFn.create(`string::repeat(${parseType(value)},${count})`) } -export function replace(value: string, search: string, replace: string) { +export function replace(value: Input, search: Input, replace: Input) { return qlFn.create(`string::replace(${parseType(value)},"${search}","${replace}")`) } -export function reverse(value: string) { +export function reverse(value: Input) { return qlFn.create(`string::reverse(${parseType(value)})`) } -export function slice(value: string, start: number, end: number) { +export function slice(value: Input, start: number, end: number) { return qlFn.create(`string::slice(${parseType(value)},${start},${end})`) } -export function slug(value: string) { +export function slug(value: Input) { return qlFn.create(`string::slug(${parseType(value)})`) } -export function split(value: string, separator = ",") { +export function split(value: Input, separator = ",") { return qlFn.create(`string::split(${parseType(value)},"${separator}")`) } -export function startsWith(value: string, search: string) { +export function startsWith(value: Input, search: Input) { return qlFn.create(`string::startsWith(${parseType(value)},"${search}")`) } -export function trim(value: string) { +export function trim(value: Input) { return qlFn.create(`string::trim(${parseType(value)})`) } -export function uppercase(value: string | qlFn) { +export function uppercase(value: Input) { return qlFn.create(`string::uppercase(${parseType(value)})`) } -export function words(value: string) { +export function words(value: Input) { return qlFn.create(`string::words(${parseType(value)})`) } -export function is_alphanum(value: string) { +export function is_alphanum(value: Input) { return qlFn.create(`string::is::alphanum(${parseType(value)})`) } -export function is_alpha(value: string) { +export function is_alpha(value: Input) { return qlFn.create(`string::is::alpha(${parseType(value)})`) } -export function is_ascii(value: string) { +export function is_ascii(value: Input) { return qlFn.create(`string::is::ascii(${parseType(value)})`) } -export function is_format(value: string, format: string) { +export function is_format(value: Input, format: Input) { return qlFn.create(`string::is::format(${parseType(value)},"${format}")`) } -export function is_domain(value: string) { +export function is_domain(value: Input) { return qlFn.create(`string::is::domain(${parseType(value)})`) } -export function is_email(value: string) { +export function is_email(value: Input) { return qlFn.create(`string::is::email(${parseType(value)})`) } -export function is_hexadecimal(value: string) { +export function is_hexadecimal(value: Input) { return qlFn.create(`string::is::hexadecimal(${parseType(value)})`) } -export function is_latitude(value: string) { +export function is_latitude(value: Input) { return qlFn.create(`string::is::latitude(${parseType(value)})`) } -export function is_longitude(value: string) { +export function is_longitude(value: Input) { return qlFn.create(`string::is::longitude(${parseType(value)})`) } -export function is_numeric(value: string) { +export function is_numeric(value: Input) { return qlFn.create(`string::is::numeric(${parseType(value)})`) } -export function is_semver(value: string) { +export function is_semver(value: Input) { return qlFn.create(`string::is::semver(${parseType(value)})`) } -export function is_url(value: string) { +export function is_url(value: Input) { return qlFn.create(`string::is::url(${parseType(value)})`) } -export function is_uuid(value: string) { +export function is_uuid(value: Input) { return qlFn.create(`string::is::uuid(${parseType(value)})`) }