Comparing version 0.4.0 to 0.4.1
@@ -21,2 +21,3 @@ /* jshint node: true */ | ||
var isString = typeof input == 'string' || (input instanceof String); | ||
var reNumeric = /^\-?\d+\.?\d*$/; | ||
var shouldParse ; | ||
@@ -27,3 +28,7 @@ var firstChar; | ||
if ((! isString) || input.length < 2) { | ||
return isString ? (parseFloat(input) || input) : input; | ||
if (isString && reNumeric.test(input)) { | ||
return parseFloat(input); | ||
} | ||
return input; | ||
} | ||
@@ -60,3 +65,3 @@ | ||
return parseFloat(input) || input; | ||
return reNumeric.test(input) ? parseFloat(input) : input; | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"author": "Damon Oehlman <damon.oehlman@gmail.com>", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"dependencies": {}, | ||
@@ -26,18 +26,26 @@ "devDependencies": { | ||
"ie": [ | ||
"latest" | ||
9, | ||
10 | ||
], | ||
"ff": [ | ||
"latest", | ||
23, | ||
24, | ||
25, | ||
"nightly" | ||
], | ||
"chrome": [ | ||
"latest", | ||
29, | ||
30, | ||
31, | ||
"canary" | ||
], | ||
"safari": [ | ||
5.1, | ||
6 | ||
], | ||
"opera": [ | ||
"latest", | ||
15, | ||
16, | ||
17, | ||
"next" | ||
], | ||
"safari": [ | ||
"latest" | ||
] | ||
@@ -44,0 +52,0 @@ } |
@@ -34,2 +34,11 @@ var test = require('tape'); | ||
test('a uuid value is unaltered', function(t) { | ||
t.plan(1); | ||
t.equal( | ||
parse('2007bf44-56a5-4a77-9b1e-b43cfac9c70f'), | ||
'2007bf44-56a5-4a77-9b1e-b43cfac9c70f', | ||
'uuid preserved' | ||
); | ||
}); | ||
test('an array is unaltered', function(t) { | ||
@@ -70,2 +79,11 @@ t.plan(1); | ||
test('correctly parse JSONified uuid', function(t) { | ||
t.plan(1); | ||
t.equal( | ||
parse(JSON.stringify('2007bf44-56a5-4a77-9b1e-b43cfac9c70f')), | ||
'\"2007bf44-56a5-4a77-9b1e-b43cfac9c70f\"', | ||
'correctly parse uuid' | ||
); | ||
}); | ||
test('correctly parse JSONified object', function(t) { | ||
@@ -72,0 +90,0 @@ t.plan(1); |
@@ -56,3 +56,6 @@ var test = require('tape'); | ||
function createSampleElement() { | ||
return document.createElement('div'); | ||
var div = document.createElement('div'); | ||
document.body.appendChild(div); | ||
return div; | ||
} | ||
@@ -62,7 +65,23 @@ | ||
var evt = document.createEvent('MouseEvents'); | ||
var bounds = el.getBoundingClientRect(); | ||
evt.initMouseEvent('click', true, true, window, | ||
0, 0, 0, 0, 0, false, false, false, false, 0, null); | ||
evt.initMouseEvent( | ||
'click', // type | ||
true, // can bubble | ||
true, // cancelable | ||
window, // window context | ||
0, // detail arg | ||
(bounds.top + 10) | 0, // screenX | ||
(bounds.left + 10) | 0, // screenY | ||
10, // clientX | ||
10, // clientY | ||
false, // ctrl? | ||
false, // alt? | ||
false, // shift? | ||
false, // meta? | ||
0, // button index, 0 = left | ||
null // related target | ||
); | ||
return el.dispatchEvent(evt); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28497
605