Skip to content

Commit

Permalink
Revert "remove redundancy"
Browse files Browse the repository at this point in the history
This reverts commit de71406.
  • Loading branch information
Casheeew committed Dec 29, 2023
1 parent de71406 commit f58d427
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions ext/js/general/cache-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class CacheMap {
*/
constructor(maxSize) {
if (!(
typeof maxSize === 'number' &&
Number.isFinite(maxSize) &&
maxSize >= 0 &&
Math.floor(maxSize) === maxSize
Expand Down
4 changes: 3 additions & 1 deletion test/cache-map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ function testConstructor() {
[true, () => new CacheMap(-1)],
[true, () => new CacheMap(1.5)],
[true, () => new CacheMap(Number.NaN)],
[true, () => new CacheMap(Number.POSITIVE_INFINITY)]
[true, () => new CacheMap(Number.POSITIVE_INFINITY)],
// @ts-expect-error - Ignore because it should throw an error
[true, () => new CacheMap('a')]
];

for (const [throws, create] of data) {
Expand Down

0 comments on commit f58d427

Please sign in to comment.