First commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
// Returns initials from string
|
||||
export const getInitials = (string: string) =>
|
||||
string.split(/\s/).reduce((response, word) => (response += word.slice(0, 1)), '')
|
||||
@@ -0,0 +1,4 @@
|
||||
export const ensurePrefix = (str: string, prefix: string) => (str.startsWith(prefix) ? str : `${prefix}${str}`)
|
||||
export const withoutSuffix = (str: string, suffix: string) =>
|
||||
str.endsWith(suffix) ? str.slice(0, -suffix.length) : str
|
||||
export const withoutPrefix = (str: string, prefix: string) => (str.startsWith(prefix) ? str.slice(prefix.length) : str)
|
||||
Reference in New Issue
Block a user