npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

functime

v0.1.2

Published

A utility to make timing functions easier on a callback call basis.

Readme

funcTime

funcTime is a debug utility that wraps around a method and utilizes console.time/End() in order to provide a more sophisticated timing functionality.

npm install functime

Quick Examples

####Internal flow (wrapping the callback from within the caller):


function doStuffWithFiles(['file1','file2','file3'], callback){
    callback = callback.time("FilesProcess");

    // Do some async operations..

    // Callback will be called normally.
    callback(err, result);
}

// Console shows:
// → [INFO] console - FilesProcess: 330ms (avg: 295ms across 6 calls)
// Also: callback.$execTime is 330.

####External flow (wrapping from outside, when calling):


var pkg = require('somePackage');
// Assume pkg has a function 'func' that gets a callback:

function callback(){...}

pkg.func(callback.time("Timing package.func"));
//OR Annonymously:

pkg.func(function(){
    //...
}.time("Timing package.func"));

Documentation

Methods

Wrapped function methods

Times and logs time passed until execution of callback. Keeps stats across calls as well.

Arguments

  • label - (optional) The label to print when reporting time. If not provided, function name will be used.
  • callback - A callback to report to log when called.

Example

function getAppIDs(cb) {
    // Callback is called normally:
    cb = cb.time("getApps execution measure");

    sqlGet("SELECT `app_id` FROM `apps` ", function (err, rows) {
        if (err) {
            cb(err);
            return;
        }
        var result = [];
        rows.forEach(function(row){
          result.push(row.app_id);
        });
        // Callback is called normally:
        cb(null, result);
    });
}

// Console will show:
// → [INFO] console - getApps execution measure: 330ms (avg: 295ms across 6 calls)
// Also: callback.$execTime is now 330.

Returns last call logged time.

Example

function do(){}
do = do.time("Do!");
do();

console.log("Method do() took: %sms", do.$execTime())
// → "Method do() took: 550ms"

Returns average logged time.

Example

function do(){}
do = do.time("Do!");
do();

console.log("Method do() took %sms on average", do.$execTimeAvg())
// → "Method do() took: 550ms on average"

Returns maximal logged time.

Example

function do(){}
do = do.time("Do!");
do();

console.log("Method do() took: %sms on it's longest run.", do.$execTimeMin())
// → "Method do() took: 2345ms on it's longest run."

Returns minimal logged time.

Example

function do(){}
do = do.time("Do!");
do();

console.log("Method do() took: %sms on it's shortest run.", do.$execTimeMin())
// → "Method do() took: 2ms on it's shortest run."

Returns amount of times function was called (amount of executions).

Example

function do(){}
do = do.time("Do!");
do();

console.log("Method do() called %s times", do.$execCount())
// → "Method do() called 5 times"

Coming Up (TDL)

  1. Config object:
    • silent: (false)
    • logLevel: (debug) warn-trace
    • rounding: (2) errParam:0
    • Completely turn off
  2. Support for annonymous functions
  3. Add flush method & label clear.
  4. Full report printing.
  5. Parallel calls support.