Stop! Hammer time.
Wait... Should this be
npm install hammertime
A configuration object can be passed to the
hammer function to configure the context for the timer.
before- function to run as setup, passed a callback to invoke when complete.
after- function to run after timer runs, results from
timeare passed to this function.
iterations- number of iterations, default is
Configuration can also be performed by composition as seen in some examples below.
hammer(config)- create and configure a timer context.
var hammer = ;;
hammer() is called, an object will be returned with the following functions.
before(fn)- function to run before
time, in lieu of configuration option.
fnis passed a callback to invoke when complete.
time(fn)- begins the iterations of
fncan be asynchronous if a callback argument is supplied.
time will also return an object that provides a single function:
after(fn)- function to run after
time's iterations, in lieu of configuration option.
fnis passed the results of
iterations- number of completed iterations.
time- time, in microseconds, that it took to complete.
ops- operations per second.