Capture and retrieve the last time a function was run.
var lastRun = require("last-run");
function myFunc() {}
myFunc();
// capture the run after (or before) calling the function
lastRun.capture(myFunc);
// retrieve the last run time
lastRun(myFunc);
//-> outputs the Date.now() when capture was calledTakes a function (fn) and returns a timestamp of the last time the function was captured.
Returns undefined if the function has not been captured.
The timestamp is always given in millisecond but the time resolution can be reduced (rounded down).
The use case is to be able to compare a build time to a file time attribute.
On some file systems, fs.stat time attributes like mtime might have one second precision.
Takes a function (fn) and captures the current timestamp with Date.now().
If passed the optional timestamp, captures that time instead of Date.now().
The captured timestamp can then be retrieved using the lastRun function.
Takes a function (fn) and removes the last run timestamp for it.
No LLMs for issues.
No LLMs for patches / pull requests.
No LLMs for comments on the bug tracker, including translation.
English is encouraged, but not required. You are welcome to post in your native language and rely on others to have their own translation tools of choice to interpret your words.
MIT