babel-core: add options for different parser/generator (#3561)
* babel-core: add options for different parser/generator * test for experiemental plugins, other babylon options * fix passing options into parser * Fix when no code is provided * fixup tests * fix tests again * use filename and fallback to cwd
This commit is contained in:
@@ -93,6 +93,11 @@ function normalizeOptions(code, opts, tokens): Format {
|
||||
* Determine if input code uses more single or double quotes.
|
||||
*/
|
||||
function findCommonStringDelimiter(code, tokens) {
|
||||
const DEFAULT_STRING_DELIMITER = "double";
|
||||
if (!code) {
|
||||
return DEFAULT_STRING_DELIMITER;
|
||||
}
|
||||
|
||||
let occurences = {
|
||||
single: 0,
|
||||
double: 0
|
||||
@@ -117,7 +122,7 @@ function findCommonStringDelimiter(code, tokens) {
|
||||
if (occurences.single > occurences.double) {
|
||||
return "single";
|
||||
} else {
|
||||
return "double";
|
||||
return DEFAULT_STRING_DELIMITER;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user