Comparing version 1.0.0 to 1.1.0
@@ -47,7 +47,9 @@ 'use strict'; | ||
function capture(fn){ | ||
function capture(fn, timestamp){ | ||
assert(isFunction(fn), 'Only functions can be captured'); | ||
assert(isExtensible(fn), 'Only extensible functions can be captured'); | ||
runtimes.set(fn, Date.now()); | ||
timestamp = timestamp || Date.now(); | ||
runtimes.set(fn, timestamp); | ||
} | ||
@@ -54,0 +56,0 @@ |
{ | ||
"name": "last-run", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Capture and retrieve the last time a function was run", | ||
@@ -5,0 +5,0 @@ "author": "Blaine Bublitz <blaine@iceddev.com> (http://iceddev.com)", |
@@ -44,5 +44,6 @@ # last-run | ||
### lastRun.capture(fn) | ||
### lastRun.capture(fn, [timestamp]) | ||
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. | ||
@@ -49,0 +50,0 @@ |
5089
47
57