mstring
Multi-line strings module for node.js
Last updated 6 years ago by rjrodger .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install mstring 
SYNC missed versions from official npm registry.

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.

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.

Current Tags

  • 0.1.2                                ...           latest (6 years ago)

3 Versions

  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 1
This Week 3
This Month 1
Last Day 0
Last Week 1
Last Month 10
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |