Permalink
Browse files

Slightly shorter regex.

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 151f0ba0765c2bdd7d8d03f61b41eb9671f398fc
Showing with 4 additions and 4 deletions.
  1. +1 −1 d3.js
  2. +2 −2 d3.min.js
  3. +1 −1 src/core/interpolate.js
View
2 d3.js
@@ -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) {
Oops, something went wrong.

0 comments on commit 151f0ba

Please sign in to comment.