diff --git a/src/util/id.spec.ts b/src/util/id.spec.ts index fa68e61..fdd43d7 100644 --- a/src/util/id.spec.ts +++ b/src/util/id.spec.ts @@ -14,4 +14,8 @@ describe('makeId', () => { it('should convert underscores to dashes', () => { expect(makeId('bluetooth-classic_129-1-1')).toMatch(idRegex); }); + + it('should convert apostrophes to dashes', () => { + expect(makeId("parent's-room")).toMatch(idRegex); + }); }); diff --git a/src/util/id.ts b/src/util/id.ts index bbe61d9..49c9f51 100644 --- a/src/util/id.ts +++ b/src/util/id.ts @@ -9,5 +9,5 @@ import slugify from 'slugify'; export function makeId(input: string): string { return slugify(input, { lower: true, - }).replace(/[_:]/g, '-'); + }).replace(/[_:']/g, '-'); }