quote
Add quotes to given string unless it already has them
Last updated 10 years ago by bahmutov .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install quote 
SYNC missed versions from official npm registry.

quote

Safe quoting a given string without adding duplicate quotes

NPM info

Build status dependencies devdependencies

Install using node or bower

npm install quote --save
bower install quote --save

Use

// node
var quote = require('quote');
quote('foo'); // "foo"
quote('"foo"'); // "foo"
quote(quote('foo')); // "foo"

In the browser just use global function quote

Changing quote character

Only single quote character is supported, default is double quotes ". To change:

var quote = require('quote')({ quotes: '*' });
quote('foo'); // *foo*
quote('bar'); // *bar*

To build and test

Because this is both Node and browser package, you need to build it using universal module definition CLI tool.

npm run build
npm test

Small print

Author: Gleb Bahmutov © 2014 @bahmutov glebbahmutov.com

License: MIT - do anything with the code, but don't blame me if it does not work.

Spread the word: tweet, star on github, etc.

Support: if you find any problems with this module, email / tweet / open issue on Github

Current Tags

  • 0.4.0                                ...           latest (10 years ago)

7 Versions

  • 0.4.0                                ...           10 years ago
  • 0.3.0                                ...           10 years ago
  • 0.2.2                                ...           10 years ago
  • 0.2.1                                ...           10 years ago
  • 0.2.0                                ...           10 years ago
  • 0.1.1                                ...           10 years ago
  • 0.1.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)
Dependents (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE