Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 151f0ba0765c2bdd7d8d03f61b41eb9671f398fc 1 parent e60bc4d
@jasondavies jasondavies authored
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) {
View
4 d3.min.js
2 additions, 2 deletions not shown
View
2  src/core/interpolate.js
@@ -162,7 +162,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) {
Please sign in to comment.
Something went wrong with that request. Please try again.