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 🙏

© 2025 – Pkg Stats / Ryan Hefner

debuk

v1.5.0

Published

Debug and performance test your code with a minimum setup

Readme

# debuk

Debug and performance test your code with a minimum setup

NPM
version NPM
downloads Build
Status Codecov Dependency
Status

How to Install

Node

$ npm install --save-dev debuk

in the code

import Debuk from 'debuk';
var Debuk = require('debuk');

Browser(UMD)

This can be directly included into client side without any dependencies via

<!--- latest version --->
<script src='https://unpkg.com/debuk/dist/debuk.js'>
<!--- minified version --->
<script src='https://unpkg.com/debuk/dist/debuk.min.js'>

<!--- a specific version --->
<script src='https://unpkg.com/[email protected]/dist/debuk.js'>

<script>
var Debuk = debuk.default;
</script>

you can also download source from the Releases

Browser

If you are using any dependency management system like webpack or browserify, you can use the Node import

Usage

Debuk is a wrapper to any function or class. You can simply wrap any function or class with Debuk and you can use it to check different runtime behaviours of that function and class.

const myFun = function MyFun(){
// implementation
}

// Wrap the method with Debuk
const myFun = Debuk(function MyFun(){
// implementation
});

class MyClass {}

// Wrap class with Debuk
const DebukClass = Debuk(MyClass);
const myClass = new DebukClass();

Simple example (Number of method calls)

var mySum = function mySum(a, b){
  return a + b;
};

var list = [1,2,3,4,5,6];
list
  .map(i => mySum(i, 5))
  .reduce((a,i)=> mySum(a + 2, mySum(i, 5)));

Can you guess the number of mySum calls in the the above code and the parameters each were called with? Change the code above to wrap mySum with Debuk as below and you can view them on your browser console alone with the time it took to execute each function.

var mySum = Debuk(function mySum(a, b){
  return a + b;
});
//Console output
mySum: 0.182ms
mySum params 1,5 => 6
mySum: 0.103ms
mySum params 2,5 => 7
mySum: 0.076ms
mySum params 3,5 => 8
mySum: 0.076ms
mySum params 4,5 => 9
mySum: 0.075ms
mySum params 5,5 => 10
mySum: 0.073ms
mySum params 6,5 => 11
mySum: 0.074ms
mySum params 7,5 => 12
mySum: 0.076ms
mySum params 8,12 => 20
mySum: 0.070ms
mySum params 8,5 => 13
mySum: 0.073ms
mySum params 22,13 => 35
mySum: 0.077ms
mySum params 9,5 => 14
mySum: 0.072ms
mySum params 37,14 => 51
mySum: 0.073ms
mySum params 10,5 => 15
mySum: 0.071ms
mySum params 53,15 => 68
mySum: 0.074ms
mySum params 11,5 => 16
mySum: 0.075ms
mySum params 70,16 => 86
mySum count: 16

Check JSBin

Console.count does the samething

Well in case you didnt know you can use console.count to do the samething. But what is more about Debuk is that it does the count per execution cycle not global. So it will show how many times the method was used for that execution cycle. In most of the cases you want to check what happens when on a particular state. (When the user clicks on this button how many times this method was called). Debuk is ideal for that.

API

debuk(fn, options, bindThis)

####fn function to be wrapped ####options options to debuk. defaults are

  {  
    name: 'Anonymous',
    params: false,
    time: true,
    trace: false,
    profile: false,
    promise: true,
    count: true,
  }

####bindThis bind this to fn or not. Default false

Contributions

  • We use sementic versioning and each build will trigger a version based on the commit message.
  • 100% test coverage.

Roadmap

  • [x] Functions returning promises
  • [x] Add ES6 Decorator support
  • [x] Add support for ES6 Classes
  • [ ] Performance statistics calculation (Mean / SD / Average)

License

MIT © 2016

`