Permalink
Browse files

Fixed variable misspelling

  • Loading branch information...
1 parent 0a813b0 commit 2c26a8a4907a6869e69b066efede7bdbd6642171 @spencertipping spencertipping committed Aug 25, 2010
Showing with 4 additions and 4 deletions.
  1. +4 −4 tools/factor-js
View
@@ -5,26 +5,26 @@ sub read_file {open my $fh, '<', shift || $_; my $result = join '', <$fh>; close
sub pieces_for {
my $code = shift || $_;
$code = read_file $code if -f $code;
- split /^([\$\w\.\[\]"']+\h*=\h*(?:function.*?\{(?:\V|\n\h)+\n^\}+;?$|\V*$))/mo, $code;
+ split /^([\$\w\.\[\]"']+\h*=\h*(?:function.*?\{(?:\V|\n\h)+\n^\}+;?\n?|\V*$))/mo, $code;
}
my @files = map [pieces_for $_], @ARGV;
my %intersection;
map ++$intersection{$_}, @$_ for @files;
# Delete entries appearing in fewer than all files:
-$intersection{$_} < @files && delete $intersection{$_} for keys %intersection;
+$intersection{$_} < @files and delete $intersection{$_} for keys %intersection;
# And write the common definitions. Arbitrarily, we use the first file for ordering:
open my $fh, '>', 'common.js';
-$intersections{$_} and print $fh $_ for @{$files[0]};
+$intersection{$_} and print $fh $_ for @{$files[0]};
close $fh;
# Now write the diffs, using whichever ordering each file gives:
for my $i (0 .. $#files) {
my ($f, $name) = ($files[$i], $ARGV[$i] =~ /(.*)\.js$/go);
open my $fh, '>', "$name.diff.js";
- $intersections{$_} or print $fh $_ for @$f;
+ $intersection{$_} or print $fh $_ for @$f;
close $fh;
}

0 comments on commit 2c26a8a

Please sign in to comment.