singlequote

1.0.0 • Public • Published

singlequote

Transform all double quote strings in a piece of JavaScript code to single quoted strings

npm install singlequote

usage

var singlequote = require("singlequote");
 
function x(){
    return "hello\" I am a string's for sure";
}
 
var singleQuoteStringsCode = singlequote(x.toString())
 
//singleQuoteStringsCode will contain the string:
function x(){
    return 'hello" I am a string\'s for sure';
}

singlequote will throw an exception if the JavaScript code can not be parsed.

singlequote will throw an error if there is a bug in singlequote, that would produce invalid JavaScript code.

running singlequote on an entire directory of .js files

Use the command line tool jsq

License

MIT

Dependencies (1)

Dev Dependencies (3)

Package Sidebar

Install

npm i singlequote

Weekly Downloads

14

Version

1.0.0

License

MIT

Last publish

Collaborators

  • fizker
  • jonatanpedersen
  • mpushkin
  • ebdrup
  • bubenshchykov
  • eagleeye
  • kapetan
  • wtfil
  • bifrost