Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

console-goodies

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-goodies

console goodies

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by66.67%
Maintainers
1
Weekly downloads
 
Created
Source

console-goodies

Console goodies for debugging. :bug: :hammer:

yarn add console-goodies.

import 'console-goodies';

/* or */

require('console-goodies');

/**
 * console.group|time|profile call automatically their console.whateverEnd
 * counterpart when the function finishes.
 *
 */
console.group('group therapy', () => {
  console.log('foo');
  console.log('bar');
  console.log('lol');
});
/**
 * LOG:
 *
 *   group-therapy/
 *   ├── bar
 *   ├── foo
 *   └── lol
 */

console.time(() => {
  verySlowSyncFunction();
});
// LOG: 42000.1337ms ellapsed

/**
 * You can specify a label too
 */
console.time('this is soooo slow', () => {
  verySlowFunction();
});
// LOG: "this is so slow" 42000.1337ms ellapsed

/**
 * And they also work with async stuff! Promises or promise-returning functions
 * call their console.whateverEnd counterpart when the promise is fulfiled.
 */
console.time(() => {
  return new Promise((resolve) => setTimeout(resolve, 1000))
});
// LOG: 999.00000000002ms ellapsed

console.time('passing a promise directly', verySlowAsyncFunction());
// LOG: "passing a promise direcly" 300.00ms ellapsed

/**
 * console.tap
 *
 *   logs and returns a value: handy for peeking into stuff
 *   without having to create an intermediate variable just
 *   for debugging purposes.
 */
const f = () => 'f'
const u = () => 'u'
const c = () => 'c'
const k = () => 'k'
const fuck = () => f(u(console.tap(c(k))))
fuck();
// LOG: 'c'

/**
 * console.wtf
 *
 *   Because this is what we all do, most of the time.
 */
console.wtf();
// LOG: 'wtf'

FAQs

Package last updated on 06 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc