Returns the calculated cat age from a human equivalent age.
For eg. a 33 year old human is a 4 years and 3 months old cat.
npm install cat-age-calculator --save
The entry file for this package is setup as an UMD module, allowing it to be used as a Node module and in the browser side too.
Pass an integer between 1 and 116 to one of the following functions...
getCatAgeObject(33);
// { years: 4, months: 3}
getCatAgeString(33);
// '4 years and 3 months'
The known human to cat age data (see table below) were captured in an array of objects and the following functionality calculates the cat age:
Cats age rapidly in the first two years of their life at a few different rates (see table below), after their second year of life each additional year is equal to about four human years.
Human equivalent age | Actual cat age |
---|---|
1 year | 1 month |
4 years | 3 months |
10 years | 6 months |
12 years | 7 months |
15 years | 1 year |
21 years | 1 year 6 months |
24 years | 2 years |
28 years | 3 years |
+ 4 years... | + 1 year... |