-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
hello I would like to use regular expression to replace a specific function call with something else.
specifically I made a function called isUndefined
which returns true if the input is not defined.
ex:
if (isUndefined(PARAM)) {
// do blah
but it appears that some browsers do not like this if PARAM has never been mentioned before
for such reasons I would like to add a build step to replace the function call with
typeof PARAM === "undefined"
the problem is that PARAM could contains parenthesis and I need it to match to the end of the matching parenthesis.
Regular expressions does have a recursive element to it. but that does not exist in javascript apparently.
So I was wondering if you had any advice on how to accomplish using your tool
Example of success:
isUndefined(funcThatMayReturnUndefined())
// changes to
typeof funcThatMayReturnUndefined() === "undefined"
Metadata
Metadata
Assignees
Labels
No labels