Esteves Enzo
rework endpoint behaviour
1ce932e
raw
history blame contribute delete
409 Bytes
export const splitStringBracket = (str: string): any[] => {
// Split string by bracket but keep the bracket
const result = str.split(/(\{.*?\})/g)
return result.map((item) => {
if (item.startsWith('{') && item.endsWith('}')) {
return {
editable: true,
content: item.slice(1, -1),
key: item,
}
} return {
editable: false,
content: item
}
})
}