Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var debug = process.env.DEBUG_JSBEAUTIFY || process.env.JSBEAUTIFY_DEBUG ? function() {
console.error.apply(console, arguments);
} : function() {};
var fs = require('fs'),
cc = require('config-chain'),
beautify = require('../index'),
mkdirp = require('mkdirp'),
nopt = require('nopt');
nopt.invalidHandler = function(key, val) {
throw new Error(key + " was invalid with value \"" + val + "\"");
};
nopt.typeDefs.brace_style = {
type: "brace_style",
validate: function(data, key, val) {
data[key] = val;
// TODO: expand-strict is obsolete, now identical to expand. Remove in future version
// TODO: collapse-preserve-inline is obselete, now identical to collapse,preserve-inline = true. Remove in future version
var validVals = ["collapse", "collapse-preserve-inline", "expand", "end-expand", "expand-strict", "none", "preserve-inline"];
var valSplit = val.split(/[^a-zA-Z0-9_\-]+/); //Split will always return at least one parameter
for (var i = 0; i < valSplit.length; i++) {
if (validVals.indexOf(valSplit[i]) === -1) {
return false;
}
}
return true;
}
};
var path = require('path'),
var debug = process.env.DEBUG_JSBEAUTIFY || process.env.JSBEAUTIFY_DEBUG ? function() {
console.error.apply(console, arguments);
} : function() {};
var fs = require('fs'),
cc = require('config-chain'),
beautify = require('../index'),
mkdirp = require('mkdirp'),
nopt = require('nopt'),
glob = require('glob');
nopt.invalidHandler = function(key, val) {
throw new Error(key + " was invalid with value \"" + val + "\"");
};
nopt.typeDefs.brace_style = {
type: "brace_style",
validate: function(data, key, val) {
data[key] = val;
// TODO: expand-strict is obsolete, now identical to expand. Remove in future version
// TODO: collapse-preserve-inline is obselete, now identical to collapse,preserve-inline = true. Remove in future version
var validVals = ["collapse", "collapse-preserve-inline", "expand", "end-expand", "expand-strict", "none", "preserve-inline"];
var valSplit = val.split(/[^a-zA-Z0-9_\-]+/); //Split will always return at least one parameter
for (var i = 0; i < valSplit.length; i++) {
if (validVals.indexOf(valSplit[i]) === -1) {
return false;
}
}
return true;
}
};
var path = require('path'),
*/
var debug = process.env.DEBUG_JSBEAUTIFY || process.env.JSBEAUTIFY_DEBUG ? function() {
console.error.apply(console, arguments);
} : function() {};
var fs = require('fs'),
cc = require('config-chain'),
beautify = require('../index'),
mkdirp = require('mkdirp'),
nopt = require('nopt');
nopt.invalidHandler = function(key, val, types) {
throw new Error(key + " was invalid with value \"" + val + "\"");
}
nopt.typeDefs.brace_style = {
type: "brace_style",
validate: function(data, key, val) {
data[key] = val;
// TODO: expand-strict is obsolete, now identical to expand. Remove in future version
// TODO: collapse-preserve-inline is obselete, now identical to collapse,preserve-inline = true. Remove in future version
var validVals = ["collapse", "collapse-preserve-inline", "expand", "end-expand", "expand-strict", "none", "preserve-inline"];
var valSplit = val.split(/[^a-zA-Z0-9_\-]+/); //Split will always return at least one parameter
for (var i = 0; i < valSplit.length; i++) {
if (validVals.indexOf(valSplit[i]) === -1) {
return false;
}
}
return true;
}
};
var path = require('path'),
*/
/*jshint strict:false */
var debug = process.env.DEBUG_JSBEAUTIFY || process.env.JSBEAUTIFY_DEBUG ? function() {
console.error.apply(console, arguments);
} : function() {};
var fs = require('fs'),
cc = require('config-chain'),
beautify = require('../index'),
mkdirp = require('mkdirp'),
nopt = require('nopt'),
glob = require('glob');
nopt.invalidHandler = function(key, val) {
throw new Error(key + " was invalid with value \"" + val + "\"");
};
nopt.typeDefs.brace_style = {
type: "brace_style",
validate: function(data, key, val) {
data[key] = val;
// TODO: expand-strict is obsolete, now identical to expand. Remove in future version
// TODO: collapse-preserve-inline is obselete, now identical to collapse,preserve-inline = true. Remove in future version
var validVals = ["collapse", "collapse-preserve-inline", "expand", "end-expand", "expand-strict", "none", "preserve-inline"];
var valSplit = val.split(/[^a-zA-Z0-9_\-]+/); //Split will always return at least one parameter
for (var i = 0; i < valSplit.length; i++) {
if (validVals.indexOf(valSplit[i]) === -1) {
return false;
}
}
-------------------------------------
Written by Daniel Stockman (daniel.stockman@gmail.com)
*/
var debug = process.env.DEBUG_JSBEAUTIFY || process.env.JSBEAUTIFY_DEBUG ? function() {
console.error.apply(console, arguments);
} : function() {};
var fs = require('fs'),
cc = require('config-chain'),
beautify = require('../index'),
mkdirp = require('mkdirp'),
nopt = require('nopt');
nopt.invalidHandler = function(key, val, types) {
throw new Error(key + " was invalid with value \"" + val + "\"");
}
nopt.typeDefs.brace_style = {
type: "brace_style",
validate: function(data, key, val) {
data[key] = val;
// TODO: expand-strict is obsolete, now identical to expand. Remove in future version
// TODO: collapse-preserve-inline is obselete, now identical to collapse,preserve-inline = true. Remove in future version
var validVals = ["collapse", "collapse-preserve-inline", "expand", "end-expand", "expand-strict", "none", "preserve-inline"];
var valSplit = val.split(/[^a-zA-Z0-9_\-]+/); //Split will always return at least one parameter
for (var i = 0; i < valSplit.length; i++) {
if (validVals.indexOf(valSplit[i]) === -1) {
return false;
}
}
return true;
// development only
if (process.env.NODE_ENV === 'development') {
app.use(errorhandler());
}
var knownOpts = {
"settings":[path],
"v": Boolean,
"help": Boolean
};
var shortHands = {
"s":["--settings"],
"?":["--help"]
};
nopt.invalidHandler = function(k,v,t) {
console.log(k,v,t);
}
var parsedArgs = nopt(knownOpts,shortHands,process.argv,2)
if (parsedArgs.help) {
console.log("Marquette");
console.log("Usage: node marquette.js [-v] [-?] [--settings settings.js]");
console.log("");
console.log("Options:");
console.log(" -s, --settings FILE use specified settings file");
console.log(" -v enable verbose output");
console.log(" -?, --help show usage");
process.exit();
}
function validate (cl) {
// warn about invalid configs at every level.
cl.list.forEach(function (conf) {
nopt.clean(conf, configDefs.types)
})
nopt.clean(cl.root, configDefs.types)
}
function validate (cl) {
// warn about invalid configs at every level.
cl.list.forEach(function (conf) {
nopt.clean(conf, configDefs.types)
})
nopt.clean(cl.root, configDefs.types)
}
function validate (cl) {
// warn about invalid configs at every level.
cl.list.forEach(function (conf) {
nopt.clean(conf, configDefs.types)
})
nopt.clean(cl.root, configDefs.types)
}
// defaults, types, and shorthands.
var path = require("path");
var url = require("url");
var Stream = require("stream").Stream;
var semver = require("semver");
var stableFamily = semver.parse(process.version);
var os = require("os");
var nopt = require("nopt");
var log = require("./log");
nopt.typeDefs.semver = { type: semver, validate: validateSemver };
function validateSemver(data, k, val) {
if (!semver.valid(val)) {
return false;
}
data[k] = semver.valid(val);
}
nopt.invalidHandler = function(k, val) {
log.warn(k + "=" + JSON.stringify(val), "invalid config");
};
if (!stableFamily || (+stableFamily[2] % 2)) {
stableFamily = null;
} else {
stableFamily = stableFamily[1] + "." + stableFamily[2];