style update to standard v7

This commit is contained in:
typicode
2016-07-03 18:50:11 +02:00
parent bf45e62b7a
commit 988ddded82
15 changed files with 12 additions and 78 deletions

View File

@ -4,7 +4,6 @@ var run = require('./run')
var pkg = require('../../package.json')
module.exports = function () {
updateNotifier({ pkg: pkg }).notify()
var argv = yargs

View File

@ -74,7 +74,6 @@ function createApp (source, object, routes, argv) {
}
module.exports = function (argv) {
var source = argv._[0]
var app
var server
@ -98,7 +97,6 @@ module.exports = function (argv) {
// Load JSON, JS or HTTP database
load(source, function (err, data) {
if (err) throw err
// Load additional routes
@ -125,7 +123,6 @@ module.exports = function (argv) {
// Start server
start(function () {
// Snapshot
console.log(
chalk.gray(' Type s + enter at any time to create a snapshot of the database')
@ -162,7 +159,6 @@ module.exports = function (argv) {
.on('change', function (file) {
if (file === source) {
if (is.JSON(file)) {
console.log(file, fs.readFileSync(file))
var obj = JSON.parse(fs.readFileSync(file))
// Compare .json file content with in memory database
var isDatabaseDifferent = !_.eq(obj, app.db.getState())

View File

@ -8,14 +8,11 @@ module.exports = function (source, cb) {
var data
if (is.URL(source)) {
request({ url: source, json: true }, function (err, response) {
if (err) return cb(err)
cb(null, response.body)
})
} else if (is.JS(source)) {
var filename = path.resolve(source)
delete require.cache[filename]
var dataFn = require(filename)
@ -26,15 +23,10 @@ module.exports = function (source, cb) {
data = dataFn()
cb(null, data)
} else if (is.JSON(source)) {
data = low(source, { storage: fileAsync }).getState()
cb(null, data)
} else {
throw new Error('Unsupported source ' + source)
}
}