about summary refs log tree commit diff
path: root/src/lib/strings
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-10-30 19:26:23 -0700
committerPaul Frazee <pfrazee@gmail.com>2023-10-30 19:26:23 -0700
commit40752982da07ff05001129e26f3ea1bca39c7ad9 (patch)
tree57ef81428b1595974e01fc8a7d21f6d6e2991d7c /src/lib/strings
parent68c809b09a056fd5e28f15fe6a114dfbb8295ba4 (diff)
parent7fa0708e0e471c6c04864400f7e212147ba73765 (diff)
downloadvoidsky-40752982da07ff05001129e26f3ea1bca39c7ad9.tar.zst
Merge branch 'main' of https://github.com/haideralipunjabi/social-app into main
Diffstat (limited to 'src/lib/strings')
-rw-r--r--src/lib/strings/helpers.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/strings/helpers.ts b/src/lib/strings/helpers.ts
index ef93a366f..381ae32f3 100644
--- a/src/lib/strings/helpers.ts
+++ b/src/lib/strings/helpers.ts
@@ -32,3 +32,8 @@ export function toHashCode(str: string, seed = 0): number {
 
   return 4294967296 * (2097151 & h2) + (h1 >>> 0)
 }
+
+export function countLines(str: string | undefined): number {
+  if (!str) return 0
+  return str.match(/\n/g)?.length ?? 0
+}