Skip to content

Commit

Permalink
refactor(yaml): cleanup dead code in float Type implementation (#5526)
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua authored Jul 24, 2024
1 parent 0dc7ce1 commit ff2f1f1
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions yaml/_type/float.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ function resolveYamlFloat(data: string): boolean {
function constructYamlFloat(data: string): number {
let value = data.replace(/_/g, "").toLowerCase();
const sign = value[0] === "-" ? -1 : 1;
const digits: number[] = [];

if (value[0] && "+-".includes(value[0])) {
value = value.slice(1);
Expand All @@ -48,21 +47,6 @@ function constructYamlFloat(data: string): number {
if (value === ".nan") {
return NaN;
}
if (value.includes(":")) {
value.split(":").forEach((v) => {
digits.unshift(parseFloat(v));
});

let valueNb = 0.0;
let base = 1;

digits.forEach((d) => {
valueNb += d * base;
base *= 60;
});

return sign * valueNb;
}
return sign * parseFloat(value);
}

Expand Down

0 comments on commit ff2f1f1

Please sign in to comment.