Skip to content

Commit

Permalink
added count_integer_digits.js
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJDufour committed Nov 22, 2022
1 parent 0e30e7a commit a22ce08
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions count_integer_digits.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use strict";

const absolute = require("./absolute.js");
const clean = require("./clean.js");

function count_integer_digits(n) {
n = absolute(clean(n));

const i = n.indexOf(".");

return (i === -1 ? n.length : i).toString();
}

module.exports = count_integer_digits;
module.exports.default = count_integer_digits;

0 comments on commit a22ce08

Please sign in to comment.