New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

doc-chomp

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

doc-chomp

Doc Chomp chomps on your document literals

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
147
decreased by-44.94%
Maintainers
1
Weekly downloads
 
Created
Source

🍴 Doc Chomp

Doc Chomp chomps on your document literals

Usage

Doc Chomp is useful for keeping nice indentation outside ES6 template literals, while making them internally clean and consistent.

const DocChomp = require('doc-chomp');

let chompedString = DocChomp`
  This string will be trimmed such that all indentation matches this line

  * Extra indentation is supported just fine
    * No problem! 👌🏼

  The line after the DocChomp call shouldn't be used, or Doc Chomp will complain!
  `

function compareStrings() {
  if (chompedString) {
    return chompedString === DocChomp`
      This string will be trimmed such that all indentation matches this line

      * Extra indentation is supported just fine
        * No problem! 👌🏼

      The line after the DocChomp call shouldn't be used, or Doc Chomp will complain!
      `;
  }
}

compareStrings(); // true!

In this example, chompedString will have two space characters trimmed from each line.

No text should be added on the same line as DocChomp, as if text was accepted here, Doc Chomp couldn't make a good choice about spacing!

FAQs

Package last updated on 19 Oct 2016

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