Skip to content

Commit a91ff28

Browse files
Shmulik-Kravitzsapegin
authored andcommitted
Fix: Do not explode when on null in replace (styleguidist#1115)
1 parent e70e461 commit a91ff28

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/rsg-components/Props/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @returns {string}
66
*/
77
export function unquote(string) {
8-
return string.replace(/^['"]|['"]$/g, '');
8+
return string && string.replace(/^['"]|['"]$/g, '');
99
}
1010

1111
/**
@@ -38,5 +38,5 @@ export function getType(prop) {
3838
* @returns {string}
3939
*/
4040
export function showSpaces(string) {
41-
return string.replace(/^\s|\s$/g, '␣');
41+
return string && string.replace(/^\s|\s$/g, '␣');
4242
}

0 commit comments

Comments
 (0)