Socket
Socket
Sign inDemoInstall

mstring

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mstring

Multi-line strings module for node.js


Version published
Weekly downloads
1.1K
increased by0.26%
Maintainers
1
Install size
5.56 kB
Created
Weekly downloads
 

Readme

Source

mstring

Multi-line Strings Module for Node.js

This is a simple little module that lets you have multi-line strings in JavaScript.

Just do this:

var M = require('mstring')

var mystring = M(function(){
  /***
  Ontario
  Mining and
  Forestry
  Group
  ***/})

to get

mystring == "Ontario\nMining and\nForestry\nGroup"

And that's pretty much it.

Install

npm install mstring

Format

An empty anonymous function, containing a single multi-line comment block. The comment block should start and end with / and /. The first and last newlines of the comment are ignored, as is any indentation.

How it Works

In Node.js, you can call the .toString method of a function, and it will give you the source code of the function definition, including any comments. A regular expression grabs the content of the comment.

Yes, it's a hack. Inspired by a throwaway comment from Dominic Tarr.

Keywords

FAQs

Last updated on 07 Jan 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc