Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ran <[email protected]>
  • Loading branch information
Oreoxmt and ran-huang authored Aug 8, 2022
1 parent b8effa2 commit a1e0636
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/replaceint.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ function replaceIntegerInternal(obj) {
replaceIntegerInternal(obj[item]);
}
else if (item == "type" && obj[item] === "integer") {
if (obj["example"] != undefined && typeof (obj["example"]) != "number") {
if (obj["example"] != undefined && typeof obj["example"] != "number") {
obj["example"] = parseInt(obj["example"]);
}
if (obj["default"] != undefined && typeof (obj["default"]) != "number") {
if (obj["default"] != undefined && typeof obj["default"] != "number") {
obj["default"] = parseInt(obj["default"]);
}
}
Expand All @@ -22,7 +22,7 @@ async function replaceInteger(readf, writef) {
const data = JSON.parse(fs.readFileSync(readf, 'utf8'));
const schema = replaceIntegerInternal(data);
fs.writeFileSync(writef, JSON.stringify(schema, null, 2));

console.log(`Replace wrong string with int in ${writef}`);
}

module.exports = replaceInteger;

0 comments on commit a1e0636

Please sign in to comment.