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

hinoki-trace

v0.1.2

Published

tracing for functions returned by hinoki factories

Downloads

9

Readme

hinoki-trace

NPM version Build Status Dependencies

tracing for functions returned by hinoki factories

  • built-in support for promise-returning functions
  • works in node.js and the browser
  • hinoki-trace makes debugging hinoki applications a blast :)

node.js setup

npm install hinoki-trace
var hinokiTrace = require('hinoki-trace');

browser setup

your markup should look something like the following

<html>
  <body>
    <!-- content... -->

    <!-- hinoki requires bluebird -->
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/bluebird/1.2.2/bluebird.js"></script>
    <!--
      hinoki-trace obviously requires hinoki
      take src/hinoki.js from the hinoki repository and include it
    -->
    <script type="text/javascript" src="hinoki.js"></script>
    <!-- take src/hinoki-trace.js from this repository and include it -->
    <script type="text/javascript" src="hinoki-trace.js"></script>
    <script type="text/javascript" src="example.js"></script>
  </body>
</html>

hinoki-trace.js makes the global variable hinokiTrace available

its best to fetch bluebird with bower, hinoki with npm, hinoki-trace with npm, and then use a build system like gulp to bring everything together

example.js

trace output on the console looks like this:

TRACE          0 | squared | <- [ 1 ]
TRACE          1 | times | <- [ 1, 1 ]
TRACE          1 | times | -> 1
TRACE          0 | squared | => promise
TRACE          2 | squared | <- [ 2 ]
TRACE          3 | times | <- [ 2, 2 ]
TRACE          3 | times | -> 4
TRACE          2 | squared | => promise
TRACE          4 | squared | <- [ 3 ]
TRACE          5 | times | <- [ 3, 3 ]
TRACE          5 | times | -> 9
TRACE          4 | squared | => promise
TRACE          6 | squared | <- [ 4 ]
TRACE          7 | times | <- [ 4, 4 ]
TRACE          7 | times | -> 16
TRACE          6 | squared | => promise
TRACE          8 | squared | <- [ 5 ]
TRACE          9 | times | <- [ 5, 5 ]
TRACE          9 | times | -> 25
TRACE          8 | squared | => promise
TRACE          0 | squared | => 1
TRACE          4 | squared | => 9
TRACE          2 | squared | => 4
TRACE          8 | squared | => 25
TRACE          6 | squared | => 16

todo

  • add support for performance profiling
    • build on top instead of built-in
  • document options (callback and nextTraceId)
  • make it possibly to register a different handler for each traced function by passing an object instead of an array
    • a value of true just uses the default handler
  • support not just factories but tracing of values which are functions as well
  • make the example more interesting
  • add timestamps to trace output

license: MIT