File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
packages/contentstack-utilities/src Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ export const validatePath = (input: string) => {
5656export const escapeRegExp = ( str : string ) => str ?. replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) ;
5757
5858// To remove the relative path
59- export const sanitizePath = ( str : string ) => str . replace ( / ^ ( \. \. ( \/ | \\ | $ ) ) + / , '' ) ;
59+ export const sanitizePath = ( str : string ) => str ? .replace ( / ^ ( \. \. ( \/ | \\ | $ ) ) + / , '' ) ;
6060
6161// To validate the UIDs of assets
6262export const validateUids = ( uid ) => / ^ [ a - z A - Z 0 - 9 ] + $ / . test ( uid ) ;
@@ -65,6 +65,6 @@ export const validateUids = (uid) => /^[a-zA-Z0-9]+$/.test(uid);
6565export const validateFileName = ( fileName ) => / ^ [ a - z A - Z 0 - 9 -_ \. ] + $ / . test ( fileName ) ;
6666
6767// Validate Regex
68- export const replaceNonAlphanumericWithEmpty = input => input . replace ( / [ ^ a - z A - Z 0 - 9 ] / g, '' ) ;
68+ export const replaceNonAlphanumericWithEmpty = input => input ? .replace ( / [ ^ a - z A - Z 0 - 9 ] / g, '' ) ;
6969
7070export const isValidURL = url => / ^ ( h t t p s ? : \/ \/ ) ? ( w w w \. ) ? [ a - z A - Z 0 - 9 - ] + ( \. [ a - z A - Z ] { 2 , } ) ( [ \/ \w . - ] * ) * \/ ? $ / . test ( url ) ;
You can’t perform that action at this time.
0 commit comments