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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ftrace

v0.2.1

Published

A simple library that traces function calls.

Downloads

4

Readme

ftrace

A simple library that traces function calls.

Usage

For example in order to use it you can simply:

#!/usr/bin/env node

var ftrace = require("ftrace");

function Foo() {
    console.log("hello from foo");
}

function Moo() {
    console.log("hello from moo");
    Foo();
}

Foo = ftrace.wrap("Foo", "file.js:4", Foo);
Moo = ftrace.wrap("Moo", "file.js:8", Moo);

Moo(3, 4); // ftrace also displays the arguments nicely.

And you should get something like:

=> Moo(3, 4) : file.js:4
  => Foo() : file.js:8
  <= Foo
<= Moo

ewrap

ewrap uses the stacktrace and can be really useful to track where functions are called, with far less instrumentation.

For example the following code:

function callSomeWrapping() {
    var FuncA = ftrace.ewrap("FuncA", "FuncA:1", function FuncA() {
    });

    var FuncB = ftrace.ewrap("FuncB", "FuncB:1", function FuncB() {
    });

    var untracedFuncA = function() {
        FuncA();
    };

    var FuncAB = ftrace.ewrap("FuncAB", "FuncAB:1", function FuncAB() {
        FuncA();
        untracedFuncA();
        FuncB();
    });

    FuncAB();
}

will output:

=> processImmediate [as _immediateCallback] () : timers.js:345:15
  => _onImmediate () : /home/raptor/.nvm/v0.10.31/lib/node_modules/mocha/lib/runner.js:276:5
    => next () : /home/raptor/.nvm/v0.10.31/lib/node_modules/mocha/lib/runner.js:248:23
      => <anonymous>() : /home/raptor/.nvm/v0.10.31/lib/node_modules/mocha/lib/runner.js:309:7
        => next () : /home/raptor/.nvm/v0.10.31/lib/node_modules/mocha/lib/runner.js:299:14
          => <anonymous>() : /home/raptor/.nvm/v0.10.31/lib/node_modules/mocha/lib/runner.js:452:12
            => runTest () : /home/raptor/.nvm/v0.10.31/lib/node_modules/mocha/lib/runner.js:374:10
              => run () : /home/raptor/.nvm/v0.10.31/lib/node_modules/mocha/lib/runnable.js:244:7
                => callFn () : /home/raptor/.nvm/v0.10.31/lib/node_modules/mocha/lib/runnable.js:251:21
                  => <anonymous> () : /home/raptor/projects/ftrace/test/ftrace-wrap-test.js:51:9
                    => callSomeWrapping () : /home/raptor/projects/ftrace/test/ftrace-wrap-test.js:22:5
                      => FuncAB() : FuncAB:1
                        => FuncAB () : /home/raptor/projects/ftrace/test/ftrace-wrap-test.js:17:9
                          => FuncA() : FuncA:1
                          <= FuncA
                        <= FuncAB
                        => FuncAB () : /home/raptor/projects/ftrace/test/ftrace-wrap-test.js:18:9
                          => untracedFuncA () : /home/raptor/projects/ftrace/test/ftrace-wrap-test.js:13:9
                            => FuncA() : FuncA:1
                            <= FuncA
                          <= untracedFuncA
                        <= FuncAB
                        => FuncAB () : /home/raptor/projects/ftrace/test/ftrace-wrap-test.js:19:9
                          => FuncB() : FuncB:1
                          <= FuncB
                        <= FuncAB
                      <= FuncAB
                    <= callSomeWrapping
                  <= <anonymous>
                <= callFn
              <= run
            <= runTest
          <= <anonymous>
        <= next
      <= <anonymous>
    <= next
  <= _onImmediate
<= processImmediate [as _immediateCallback]```