summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/text-utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/ui/src/components/text-utils.ts')
-rw-r--r--packages/ui/src/components/text-utils.ts17
1 files changed, 0 insertions, 17 deletions
diff --git a/packages/ui/src/components/text-utils.ts b/packages/ui/src/components/text-utils.ts
deleted file mode 100644
index c094b5e65..000000000
--- a/packages/ui/src/components/text-utils.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-/** Find the longest common character prefix between two strings. */
-export function commonPrefix(a: string, b: string) {
- const ac = Array.from(a)
- const bc = Array.from(b)
- let i = 0
- while (i < ac.length && i < bc.length && ac[i] === bc[i]) i++
- return {
- prefix: ac.slice(0, i).join(""),
- aSuffix: ac.slice(i).join(""),
- bSuffix: bc.slice(i).join(""),
- }
-}
-
-export function list<T>(value: T[] | undefined | null, fallback: T[]): T[] {
- if (Array.isArray(value)) return value
- return fallback
-}