]> git.ardis.lu - 4-byte-gen/commitdiff
Parse functions with space between identifier and parenthesis
authorArdis Lu <ardisglu@gmail.com>
Sun, 11 Feb 2024 01:57:00 +0000 (17:57 -0800)
committerArdis Lu <ardisglu@gmail.com>
Sun, 11 Feb 2024 01:57:00 +0000 (17:57 -0800)
index.html

index 16c61caa3648969a6e9dc0db20319cfe7c98a8e3..667663f00a374093574faa0db89daab70a0cf6b5 100644 (file)
       // "... returns ()", then all keywords up until the last "returns" type is included in params.
       let functionRegex;
       if (strict) {
-        functionRegex = /^(function )(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)(?!.+\))/;
+        functionRegex = /^(function )(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) *\((?<parameters>.*?)(?!.+\))/;
       }
       else {
         fn = fn.replaceAll(/[;'"]/g, ''); // Clean all characters that definitely do not affect the signature
-        functionRegex = /^(function )?(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)(?!.+\))/;
+        functionRegex = /^(function )?(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) *\((?<parameters>.*?)(?!.+\))/;
       }
 
       const { name, parameters } = functionRegex.exec(fn).groups;
This page took 0.047081 seconds and 4 git commands to generate.