Skip to content
This repository
Browse code

optional whitespace for func statement

  • Loading branch information...
commit 692b957871a78fcc7894d1127ad6145654742f88 1 parent 62458cb
TJ Holowaychuk authored December 04, 2011

Showing 1 changed file with 1 addition and 2 deletions. Show diff stats Hide diff stats

  1. 3  lib/dox.js
3  lib/dox.js
... ...
@@ -1,4 +1,3 @@
1  
-
2 1
 /*!
3 2
  * Dox
4 3
  * Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
@@ -200,7 +199,7 @@ exports.parseCodeContext = function(str){
200 199
   var str = str.split('\n')[0];
201 200
 
202 201
   // function statement
203  
-  if (/^function (\w+) ?\(/.exec(str)) {
  202
+  if (/^function (\w+) *\(/.exec(str)) {
204 203
     return {
205 204
         type: 'function'
206 205
       , name: RegExp.$1

2 notes on commit 692b957

Nathan Rajlich

Nice. What's * do?
Also, I wanna match a function named $ :p What can we change the (\w+) to to allow for that?

TJ Holowaychuk

oh right haha forgot about $ being valid, we can just swap the \w+s to [$\w]+ for now. the * just means zero or more

Please sign in to comment.
Something went wrong with that request. Please try again.