aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgdocs.js5
-rw-r--r--src/Injector.js2
-rw-r--r--test/InjectorSpec.js6
3 files changed, 11 insertions, 2 deletions
diff --git a/gdocs.js b/gdocs.js
index 4507931d..82bd3df4 100755
--- a/gdocs.js
+++ b/gdocs.js
@@ -64,6 +64,11 @@ function download(name, url) {
// strip out all text annotations
data = data.replace(/\[\w{1,3}\]/mg, '');
+ // fix smart-quotes
+ data = data.replace(/[“”]/g, '"');
+ data = data.replace(/[‘’]/g, "'");
+
+
data = data + '\n';
fs.writeFileSync('docs/' + name, reflow(data, 100));
}
diff --git a/src/Injector.js b/src/Injector.js
index a5a0b540..5ba2cbfc 100644
--- a/src/Injector.js
+++ b/src/Injector.js
@@ -92,7 +92,7 @@ function angularServiceInject(name, fn, inject, eager) {
* extracting all arguments which start with $ or end with _ as the
* injection names.
*/
-var FN_ARGS = /^function [^\(]*\(([^\)]*)\)/;
+var FN_ARGS = /^function\s*[^\(]*\(([^\)]*)\)/;
var FN_ARG_SPLIT = /,/;
var FN_ARG = /^\s*(((\$?).+?)(_?))\s*$/;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
diff --git a/test/InjectorSpec.js b/test/InjectorSpec.js
index c876f188..e9a528cc 100644
--- a/test/InjectorSpec.js
+++ b/test/InjectorSpec.js
@@ -65,11 +65,15 @@ describe('injector', function(){
fn.$inject = ['a'];
expect(injectionArgs(fn)).toBe(fn.$inject);
expect(injectionArgs(function(){})).toEqual([]);
+ expect(injectionArgs(function (){})).toEqual([]);
+ expect(injectionArgs(function (){})).toEqual([]);
+ expect(injectionArgs(function /* */ (){})).toEqual([]);
});
it('should create $inject', function(){
// keep the multi-line to make sure we can handle it
- function $f_n0(
+ function $f_n0 /*
+ */(
$a, // x, <-- looks like an arg but it is a comment
b_, /* z, <-- looks like an arg but it is a
multi-line comment