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

mp-debugger

v0.0.1

Published

Simple modular object to debbug code (ex. showing in console, creating logs etc.)

Downloads

1

Readme

#Debugger Simple modular object to debbug code (ex. showing in console, creating logs etc.)

Usage

Include js combined file.

<script src="dist/debugger.js"></script>

Add code before your js files to avoid error when you don`t include debbuger files in production version.

if(typeof DEBUGGER == "undefined") DEBUGGER = {run: function(){},addMethod: function(){}};

Run debbuger method

DEBUGGER.run(methodName,vars[,moduleName]);

Arguments:

| Argument | Type | Description |--------|---------|------------ | methodName | string | Method name | vars | mixed | Vars which are passed to method | moduleName | string | Module name from you call debugger method- is used to simply know where you call method- e.g. method log show in console this property

Example

DEBUGGER.run("info","Some message");

Add methods

To add your own methods call addMethod on object.

DEBUGGER.addMethod(methodName,content [, requiredvars]);

Arguments:

| Argument | Type | Description |--------|---------|------------ | methodName | string | Method name | content | function | Method, argument is 'vars' which are passed in call method | requiredvars | array | All required vars which must contain 'vars' object, not required when you pass only one var

If you dont pass object in call function, debugger create object with 'default' property. Futhermore add 'moduleNameCall' property- moduleName in call method.

Example:

DEBUGGER.addMethod("log", function(Vars){
  
	this.print(Vars.moduleNameCall, Vars.default, "log");
	return true; // all method must return bool var
		
});

 ...
 
DEBUGGER.run("log","Some message"); // string "Some message" is added to Vars.default property

Methods utils

In 'this' object you can use utils methods like:

this.print()

Print messages in console, special debug bar or log file.

this.print(module, message[, type='log', plain=false]);

| Argument | Type | Default | Description |--------|---------|-------|--------- | module | string | - |Module name | message | string | - |Show error in console | type | string | log |Message type {log,warn,info,error} | plain | bool | false |Don`t print module name

this.setObject()

Save an object for later.

this.setObject(key, object[, methodName='debuger:setObject']);

| Argument | Type | Default | Description |--------|---------|-------|--------- | key | string | - | Key | object | mixed | - | Object to save | methodName | string | debuger:setObject | Message type {log,warn,info,error}

this.getObject()

Get previously saved objects.

this.getObject(key, [, methodName='debuger:setObject']);

| Argument | Type | Default | Description |--------|---------|-------|--------- | key | string | - | Key | methodName | string | debuger:setObject | Method name

this.deleteObject()

Delete an saved object.

this.deleteObject(key [, methodName='debuger:setObject']);

| Argument | Type | Default | Description |--------|---------|-------|--------- | key | string | - | Key | methodName | string | debuger:deleteObject | Method name

Available default methods

List of methods:

| Method | Arguments | Description |--------|-------------|------------- | log | message(string) | Show log in console | | error | message(string) | Show error in console | warn | message(string) | Show warn in console | info | message(string) | Show info in console | startTimer | id(string) | Start timer with passed id | stopTimer | id(string) | Stop timer with passed id and return time in ms | isLibrary | Library(string) | Check if in global scobe is attached library

To do

  • Add debugger method where you can show messages, errors etc... Now you must open console.
  • Add method setConfig which you can set if message shoud show in console or in bar.
  • Add some aliases to different libraries (like fps graph etc).
  • Add method to log and write in file all messages.