Skip to content

Commit

Permalink
fix: enhance function
Browse files Browse the repository at this point in the history
  • Loading branch information
adyfk committed Mar 19, 2024
1 parent 3c48177 commit c320147
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/createParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ export function createParser(props: ExpressionParserConstructor = {}) {
return false
}
},
is_email: (_, value: any) => {
try {
return !!value?.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/g);
} catch (error) {
return false;
}
},
is_html_empty: (_, value: any) => {
try {
if (!value) return true;
if (value === "<div></div>") return true;
if (value === "<span></span>") return true;
return false;
} catch (error) {
return false;
}
},
// NUMBER ==================================================================================
ceil: (_, value: number) => Math.ceil(value),
round: (_, value: number) => Math.round(value),
Expand Down

0 comments on commit c320147

Please sign in to comment.