Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function initWeb (projectDir) {
let chimeraVersion, mongoUrl
nsync.series([
// read mongoUrl
(callback) => {
const defaultMongoUrl = 'mongodb://localhost/' + projectDir
dollar.prompt('Mongodb Url (' + defaultMongoUrl + '):', function (error, url) {
if (error) {
console.error('[ERROR] Cannot read mongodb url')
return finalCallback(error)
}
if (util.isNullOrUndefined(url) || url === '') {
mongoUrl = defaultMongoUrl
} else {
mongoUrl = url
}
return callback()
})
async.eachSeries(data, (d, callback) => {
async.series([
(callback) => activate(d.inputs, callback),
(callback) => propagate(d.outputs, callback),
(callback) => {
console.log("Trained");
callback()
},
(callback) => {
console.log(h[0].connections.incoming[0].weight + " " + h[0].connections.incoming[1].weight + " "
+ h[1].connections.incoming[0].weight + " " + h[1].connections.incoming[1].weight)
// console.log(_.last(o[0].outputs).s + " " + _.last(o[0].outputs).e + " " + _.last(o[0].outputs).d)
// console.log(_.last(o[1].outputs).s + " " + _.last(o[1].outputs).e + " " + _.last(o[1].outputs).d)
console.log()
callback()
},
], callback)
}, callback)
function mainProcess (state, cckState, $, chainNames, groupKey, callback) {
// add `chainNames` to actions sequentially
let actions = []
for (let chainName of chainNames) {
actions.push((next) => {
if (cckState.result.status < 400 && cckState.schema[chainName]) {
return $.runChain(cckState.schema[chainName], cckState, state, (error, newCckState) => {
cckState = newCckState
return next(error)
})
}
return next()
})
}
// run the actions and do the callback
return async.series(actions, (error, result) => {
let response = {
error,
cckState,
status: (cckState && 'result' in cckState && 'status' in cckState.result) ? cckState.result.status : 500,
data: (cckState && 'result' in cckState) ? cckState.result : {}
}
return callback(error, response)
})
}
chain = getTrueRootChain(chain)
initVars(chain, ins, vars)
logObject(chain, 'Root chain')
// preprocess the callback
userCallback = createDefaultCallback(userCallback)
let finalActionExecuted = false
let finalAction = (error, result) => {
if(finalActionExecuted){
return
}
finalActionExecuted = true
userCallback(error, getVar(chain.out))
}
let chainRunner = createChainRunner(chain, finalAction)
log('Execute root chain runner')
async.series([chainRunner], finalAction)
}
if (!subCommand) {
makeDatabaseTableWithReset();
} else {
makeModuleDatabaseTableWithReset(subCommand);
}
break;
case 'theme':
makeThemeConfigFile();
break;
case 'admin':
makeAdminAccount();
break;
case 'all':
const tasks = [loadModuleList, makeDatabaseConfigFile, makeDatabaseTable, makeThemeConfigFile, makeAdminAccount];
async.series(tasks, function(err, res) {
console.log(res);
});
break;
default:
console.log(clc.whiteBright.underline(" = run setup script by each configuration \n"));
console.log(" > node core/setup module");
console.log(" > node core/setup db");
console.log(" > node core/setup db-init [module name]");
console.log(" or ( > node core/setup db-reset [module name]) for reset table");
console.log(" > node core/setup theme");
console.log(" > node core/setup admin \n");
console.log(clc.whiteBright(" or \n"));
console.log(" > node core/setup all \n");
}
'neo-async': function(callback) {
neo_async.series(tasks, callback);
},
//'iojs': function(callback) {
'neo-async_v0': function(callback) {
neo_async_v0.series(tasks, callback);
},
'neo-async_v1': function(callback) {