Skip to content

Commit

Permalink
feat: method options
Browse files Browse the repository at this point in the history
  • Loading branch information
Elin Angelow committed Jan 4, 2024
1 parent cf1936e commit 6e25aa8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @typedef {Object} AddValue
* @property {import('../types.js').messageFn} fn
*/

const counter = () => {
/**
* @constant {number}
*/
let cc = 0;
/**
* @returns {number}
*/
return () => {
if ((Number.MAX_SAFE_INTEGER - 1) === cc) {
cc = 0;
}
return ++cc;
};
};

module.exports = {
counter
};

0 comments on commit 6e25aa8

Please sign in to comment.