Support back to node v4

master
James Long 2017-01-10 12:18:22 -05:00
parent 9a781cbcff
commit 4abb8ce544
6 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/env node
"use strict";
const fs = require("fs");
const minimist = require("minimist");

View File

@ -1,3 +1,4 @@
"use strict";
const babylon = require("babylon");
const Printer = require("./src/printer").Printer;
const flowParser = require("flow-parser");
@ -26,7 +27,8 @@ var babylonOptions = {
};
module.exports = {
format: function(text, opts={}) {
format: function(text, opts) {
opts = opts || {};
let ast;
if(opts.useFlowParser) {

View File

@ -1,3 +1,4 @@
"use strict";
const assert = require("assert");
function assertDoc(val) {
@ -156,7 +157,10 @@ function fits(next, restCommands, width) {
}
}
const [ ind, mode, doc ] = cmds.pop();
const x = cmds.pop();
const ind = x[0];
const mode = x[1];
const doc = x[2];
if (typeof doc === "string") {
width -= doc.length;
@ -213,7 +217,10 @@ function print(w, doc) {
let out = [];
let shouldRemeasure = false;
while (cmds.length !== 0) {
const [ ind, mode, doc ] = cmds.pop();
const x = cmds.pop();
const ind = x[0];
const mode = x[1];
const doc = x[2];
if (typeof doc === "string") {
out.push(doc);

View File

@ -1,3 +1,4 @@
"use strict";
var assert = require("assert");
var sourceMap = require("source-map");
var printComments = require("./comments").printComments;

View File

@ -1,3 +1,4 @@
"use strict";
var assert = require("assert");
var types = require("ast-types");
var getFieldValue = types.getFieldValue;

View File

@ -1,3 +1,4 @@
"use strict";
const fs = require('fs');
const jscodefmt = require("../");
const recast = require("recast");