diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/constants.ts | 1 | ||||
-rw-r--r-- | src/lib/strings/helpers.ts | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 81a6d4e77..472b59d76 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -147,3 +147,4 @@ export const HITSLOP_10 = createHitslop(10) export const HITSLOP_20 = createHitslop(20) export const HITSLOP_30 = createHitslop(30) export const BACK_HITSLOP = HITSLOP_30 +export const MAX_POST_LINES = 25 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 +} |