https://github.com/taufik-nurrohman/quote
Convert double quote to single quote in string and vice-versa.
https://github.com/taufik-nurrohman/quote
converter helper node quote string utility
Last synced: 3 months ago
JSON representation
Convert double quote to single quote in string and vice-versa.
- Host: GitHub
- URL: https://github.com/taufik-nurrohman/quote
- Owner: taufik-nurrohman
- License: mit
- Created: 2020-11-16T10:21:24.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-07-01T13:30:14.000Z (about 4 years ago)
- Last Synced: 2025-09-21T12:01:57.723Z (10 months ago)
- Topics: converter, helper, node, quote, string, utility
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Quote Utility
=============
Convert double quote to single quote in string and vice-versa.
Usage
-----
### CommonJS
~~~ js
const {toggleQuote} = require('@taufik-nurrohman/quote');
console.log(toggleQuote(`foo "bar" baz 'qux'`));
~~~
### ECMAScript
~~~ js
import {toggleQuote} from '@taufik-nurrohman/quote';
console.log(toggleQuote(`foo "bar" baz 'qux'`));
~~~
Methods
-------
### doubleQuote(string)
Convert single quotes to double quotes.
~~~ js
let test = `foo "bar" baz 'qux'`;
console.log(doubleQuote(test));
~~~
### noQuote(string)
Remove quotes in string.
~~~ js
let test = `foo "bar" baz 'qux'`;
console.log(noQuote(test));
~~~
### singleQuote(string)
Convert double quotes to single quotes.
~~~ js
let test = `foo "bar" baz 'qux'`;
console.log(singleQuote(test));
~~~
### toggleQuote(string)
Toggle quotes. Convert single quotes to double quotes, double quotes to single quotes.
~~~ js
let test = `foo "bar" baz 'qux'`;
console.log(toggleQuote(test));
~~~
### HTML.doubleQuote(string)
Force HTML attribute’s quote to double quote.
~~~ js
let test = `
`;
console.log(HTML.doubleQuote(test));
~~~
### HTML.noQuote(string)
Remove quotes in HTML attribute’s value where possible.
~~~ js
let test = `
`;
console.log(HTML.noQuote(test));
~~~
### HTML.singleQuote(string)
Force HTML attribute’s quote to single quote.
~~~ js
let test = `
`;
console.log(HTML.singleQuote(test));
~~~
### JSON.noQuote(string)
Remove quotes in JSON keys.
~~~ js
let test = `{"foo": "bar"}`;
console.log(singleQuote(JSON.noQuote(test)));
~~~
### SGML.doubleQuote(string)
~~~ js
let test = ``;
console.log(SGML.doubleQuote(test));
~~~
### SGML.noQuote(string)
Remove quotes in SGML attribute’s value where possible.
~~~ js
let test = ``;
console.log(SGML.noQuote(test));
~~~
### SGML.singleQuote(string)
~~~ js
let test = ``;
console.log(SGML.singleQuote(test));
~~~
### XML.doubleQuote(string)
~~~ js
let test = ``;
console.log(XML.doubleQuote(test));
~~~
### XML.singleQuote(string)
~~~ js
let test = ``;
console.log(XML.singleQuote(test));
~~~