From 960473494b6616b7ab4050c0840aa1ba8521407a Mon Sep 17 00:00:00 2001 From: Matthew Gerstman Date: Wed, 19 Jan 2022 11:13:01 -0500 Subject: [PATCH] Add toString to fix bug in storybook --- src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.ts b/src/index.ts index e9c1b90..4e6a855 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,6 +8,9 @@ import startCase from 'lodash/startCase'; export const sanitize = (string: string) => { return ( string + // Storybook will occasionally pass a number which throws. + // This prevents that from crashing a build. + .toString() .toLowerCase() // eslint-disable-next-line no-useless-escape .replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, '-')