Skip to content

Commit

Permalink
Slightly shorter regex.
Browse files Browse the repository at this point in the history
Exactly the same speed in Chrome (probably both are optimised into the
same form): http://jsperf.com/number-matching
  • Loading branch information
jasondavies committed Nov 4, 2011
1 parent e60bc4d commit 151f0ba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion d3.js
Expand Up @@ -896,7 +896,7 @@ d3.interpolateObject = function(a, b) {
};
}

var d3_interpolate_number = /[-+]?(?:\d+\.\d+|\d+\.|\.\d+|\d+)(?:[eE][-+]?\d+)?/g,
var d3_interpolate_number = /[-+]?(?:\d*\.?\d+)(?:[eE][-+]?\d+)?/g,
d3_interpolate_rgb = {background: 1, fill: 1, stroke: 1};

function d3_interpolateByName(n) {
Expand Down

0 comments on commit 151f0ba

Please sign in to comment.