Skip to content

Commit

Permalink
add --map and --select support for dotted ids
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Oct 17, 2012
1 parent 9e8a8b0 commit b5b15a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/jog
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var selects = [];
// --map

program.on('map', function(val){
if (/^\w+$/.test(val)) val = '_.' + val;
if (/^[\w.]+$/.test(val)) val = '_.' + val;
maps.push(new Function('_', 'return ' + val));
});

Expand All @@ -35,7 +35,7 @@ program.on('type', function(val){
// --select

program.on('select', function(val){
if (/^\w+$/.test(val)) val = '_.' + val;
if (/^[\w.]+$/.test(val)) val = '_.' + val;
selects.push(new Function('_', 'return ' + val));
});

Expand Down

3 comments on commit b5b15a5

@cpsubrian
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this introduced a bug. Shouldn't the regex be /^[\w\.]+$/ ?

@tj
Copy link
Owner Author

@tj tj commented on b5b15a5 Oct 23, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, within a char class it's literal

@cpsubrian
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'the more you know' ...

Please sign in to comment.