lovely. got a couple of partial implementations....
This commit is contained in:
parent
89ca4013fd
commit
89f526e9d9
14 changed files with 180 additions and 154 deletions
15
src/utilities.ts
Normal file
15
src/utilities.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
export const splitAt = (subject: string, index: number): readonly [string, string] => {
|
||||
if (index < 0) {
|
||||
return [subject, ''];
|
||||
}
|
||||
|
||||
if (index > subject.length) {
|
||||
return [subject, ''];
|
||||
}
|
||||
|
||||
return [subject.slice(0, index), subject.slice(index + 1)];
|
||||
};
|
||||
|
||||
export const toSlug = (subject: string) => {
|
||||
return subject.toLowerCase().replaceAll(' ', '-');
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue