Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.
/ js-client Public archive

Commit

Permalink
fixinf if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
gerald-wicks-unvoid committed Jun 7, 2022
1 parent c5b2df0 commit 93152ae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/value-objects/regex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export type RawRegex = string;

export const toRegex = (raw: RawRegex): Regex => {
const flags = takeRightWhile(raw, char => char !== '/').join('');
const source = raw.length >= 1 ? raw.substring(1, raw.length - (flags.length + 2)) : '';
let source = '';

if (raw !== undefined && raw.length) {
source = raw.length > 0 ? raw.substr(1, raw.length - (flags.length + 2)) : '';
}

return new RegExp(source, flags);
};
Expand Down

0 comments on commit 93152ae

Please sign in to comment.