Skip to content

Commit

Permalink
Fix parseFloat mistaken uses of "radix"
Browse files Browse the repository at this point in the history
Summary: It doesn't take a radix. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat

Reviewed By: yungsters

Differential Revision: D5000954

fbshipit-source-id: fe13896196f0369b1dce132cd4f30d086638740e
  • Loading branch information
zertosh authored and facebook-github-bot committed May 4, 2017
1 parent f5056f8 commit 37f3ce1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Libraries/Animated/src/AnimatedImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1138,12 +1138,12 @@ class AnimatedInterpolation extends AnimatedWithChildren {
return value;
}
if (/deg$/.test(value)) {
const degrees = parseFloat(value, 10) || 0;
const degrees = parseFloat(value) || 0;
const radians = degrees * Math.PI / 180.0;
return radians;
} else {
// Assume radians
return parseFloat(value, 10) || 0;
return parseFloat(value) || 0;
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/StyleSheet/normalizeColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function parse1(str: string): number {

function parsePercentage(str: string): number {
// parseFloat conveniently ignores the final %
var int = parseFloat(str, 10);
var int = parseFloat(str);
if (int < 0) {
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/StyleSheet/processTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function _multiplyTransform(
* Note that validation on the string is done in `_validateTransform()`.
*/
function _convertToRadians(value: string): number {
var floatValue = parseFloat(value, 10);
var floatValue = parseFloat(value);
return value.indexOf('rad') > -1 ? floatValue : floatValue * Math.PI / 180;
}

Expand Down
2 changes: 1 addition & 1 deletion packager/src/node-haste/lib/getAssetDataFromName.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function getAssetDataFromName(filename: string, platforms: Set<string>): AssetDa
if (!(match && match[1])) {
resolution = 1;
} else {
resolution = parseFloat(match[1], 10);
resolution = parseFloat(match[1]);
if (isNaN(resolution)) {
resolution = 1;
}
Expand Down

0 comments on commit 37f3ce1

Please sign in to comment.