1.0.4 • Published 2 years ago

happy-numbers2 v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

A small JavaScript library built for happy numbers.

Written by Tyson Jones.

import { generateHappyNumbers, isHappy } from "happy-numbers2";

generateHappyNumbers(5); // Returns [ 1, 7, 10, 13, 19 ]
isHappy(7); // Returns true.
isHappy(5); // Returns false.

API

generateHappyNumbers(count: number, min = 1, max = Infinity): number[];
  • count specifies how many numbers you want to generate.
  • min The inclusive number to start generating from (whether or not it be a happy number).
  • max The inclusive number to stop generating at (whether or not it be a happy number).

The function will return an array once either count or max is reached.

isHappy(num: number): boolean;
  • num is the number you want to check.

Enjoy!

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago