Sum Digits

GitMoji License: MIT Lines Of Code CodeQL

You can get this package by nest.land or deno.land.

Usage

This package exposes two Functions, sumDigits and sumDigitsSync.

import sumDigits, {
  sumDigitsSync,
} from "https://deno.land/x/sum_digits/mod.ts";

console.log(await sumDigits(45)); // 9
console.log(await sumDigits("450")); // 9

async function somethingAsync() {
  console.log(await sumDigits("92"));
}

somethingAsync(); // 11

sumDigits(123).then((number) => console.log(number)); // 6

console.log(sumDigitsSync(1231)); // 7

License

This project is licensed under the MIT License.