Added show more for long posts

This commit is contained in:
Haider Ali Punjabi 2023-10-26 19:38:39 +05:30
parent c13b6946ba
commit 7fa0708e0e
6 changed files with 64 additions and 5 deletions

View file

@ -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

View file

@ -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
}