diff options
Diffstat (limited to 'docs/v3/autoInject.js.html')
-rw-r--r-- | docs/v3/autoInject.js.html | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/docs/v3/autoInject.js.html b/docs/v3/autoInject.js.html index 9506289..32f9316 100644 --- a/docs/v3/autoInject.js.html +++ b/docs/v3/autoInject.js.html @@ -30,7 +30,7 @@ </div> <ul class="nav navbar-nav"> <li id="version-dropdown" class="dropdown"> - <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.2 <span class="caret"></span> + <a href="#" class="dropdown-toggle vertically-centered" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">v3.2.3 <span class="caret"></span> </a> <ul class="dropdown-menu"> <li><a href="../v3/">v3.0.x</a></li> @@ -75,19 +75,45 @@ <section> <article> - <pre class="prettyprint source linenums"><code>import auto from './auto'; -import wrapAsync from './internal/wrapAsync'; -import { isAsync } from './internal/wrapAsync'; + <pre class="prettyprint source linenums"><code>import auto from './auto.js' +import wrapAsync from './internal/wrapAsync.js' +import { isAsync } from './internal/wrapAsync.js' var FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/; var ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/; var FN_ARG_SPLIT = /,/; var FN_ARG = /(=.+)?(\s*)$/; -var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; + +function stripComments(string) { + let stripped = ''; + let index = 0; + let endBlockComment = string.indexOf('*/'); + while (index < string.length) { + if (string[index] === '/' && string[index+1] === '/') { + // inline comment + let endIndex = string.indexOf('\n', index); + index = (endIndex === -1) ? string.length : endIndex; + } else if ((endBlockComment !== -1) && (string[index] === '/') && (string[index+1] === '*')) { + // block comment + let endIndex = string.indexOf('*/', index); + if (endIndex !== -1) { + index = endIndex + 2; + endBlockComment = string.indexOf('*/', index); + } else { + stripped += string[index]; + index++; + } + } else { + stripped += string[index]; + index++; + } + } + return stripped; +} function parseParams(func) { - const src = func.toString().replace(STRIP_COMMENTS, ''); - let match = src.match(FN_ARGS) + const src = stripComments(func.toString()); + let match = src.match(FN_ARGS); if (!match) { match = src.match(ARROW_FN_ARGS); } |