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

consoleonly

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

consoleonly

Write to the console only after an expected write to the console has already occurred

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

ConsoleOnly

Write to the console only after an expected write has already occurred

  • Suppresses console logging you are not interested in
  • Useful for debugging and tracing
  • Zero dependencies
  • Works in Node and the Browser

Install

$ npm i consoleonly

Init

Node

import ConsoleOnly from 'consoleonly'
// ... See example.js

Browser

<script type="module">
  import ConsoleOnly from 'https://cdn.jsdelivr.net/gh/draeder/consoleonly/index.js'
  // ... See example.html
</script>

Example

let consoleOnly = ConsoleOnly()

// Enable console.only
console.only.on()

console.only('This will never log, because console.only expects an index > 0')

console.only(3,'This will never log, because 2 has not fired yet')

console.only(1,'This will log first')

console.log('This will never log, because we are only interested in console.only')

console.only(2,'This will log second')

// Disable console.only
console.only.off()

console.log('This will log as normal')

console.log('So will this')

console.only(4, 'This will not log, because console.only has been disabled')

Keywords

FAQs

Package last updated on 19 May 2022

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