Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bahmutov/quote
Surround given string with quotes unless it is already surrounded.
https://github.com/bahmutov/quote
double quote shell single
Last synced: 16 days ago
JSON representation
Surround given string with quotes unless it is already surrounded.
- Host: GitHub
- URL: https://github.com/bahmutov/quote
- Owner: bahmutov
- License: mit
- Created: 2014-09-28T21:45:51.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-04-06T18:04:11.000Z (over 9 years ago)
- Last Synced: 2024-05-01T23:51:46.318Z (7 months ago)
- Topics: double, quote, shell, single
- Language: JavaScript
- Size: 227 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# quote
> Safe quoting a given string without adding duplicate quotes
[![NPM info][nodei.co]](https://npmjs.org/package/quote)
[![Build status][ci-image]][ci-url]
[![dependencies][dependencies-image]][dependencies-url]
[![devdependencies][quote-devdependencies-image] ][quote-devdependencies-url]Install using node or bower
npm install quote --save
bower install quote --saveUse
// 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*For common markdown quote characters, use [quote-markdown](https://github.com/bahmutov/quote-markdown).
## To build and test
Because this is both Node and browser package, you need to build it using
[universal module definition CLI tool](https://github.com/ForbesLindesay/umd).npm run build
npm test## Small print
Author: Gleb Bahmutov © 2014
[@bahmutov](https://twitter.com/bahmutov) [glebbahmutov.com](http://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
[ci-image]: https://travis-ci.org/bahmutov/quote.png?branch=master
[ci-url]: https://travis-ci.org/bahmutov/quote
[nodei.co]: https://nodei.co/npm/quote.png?downloads=true
[dependencies-image]: https://david-dm.org/bahmutov/quote.png
[dependencies-url]: https://david-dm.org/bahmutov/quote
[quote-devdependencies-image]: https://david-dm.org/bahmutov/quote/dev-status.png
[quote-devdependencies-url]: https://david-dm.org/bahmutov/quote#info=devDependencies