-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Description
If you pass a regExp as second argument in function reactStringReplace
you can get error like: Cannot read property "length" of undefined
. I think thiss is caused by the work of vanilla replace
method.
For example, this code give us an error (it's cyrillic):
const str = 'Справка Форма Ф9';
const re = /(справка[а-я].?(по)? форм[а-я] [ф|Ф]\d)/gi
console.log(str.split(re)); // ["", "Справка Форма Ф9", undefined, ""]
So you cannot get length proprty of undefined. And this error will crush you page.
Metadata
Metadata
Assignees
Labels
No labels