Skip to content

Commit

Permalink
fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
StarpTech committed Oct 2, 2017
1 parent c0768b3 commit a65e92c
Show file tree
Hide file tree
Showing 89 changed files with 565 additions and 567 deletions.
8 changes: 4 additions & 4 deletions examples/authentication/jwt.js
Expand Up @@ -27,7 +27,7 @@ hemera.ready(() => {
scope: 'math'
}
},
function (req, cb) {
function(req, cb) {
cb(null, req.a - req.b)
}
)
Expand All @@ -39,15 +39,15 @@ hemera.ready(() => {
scope: 'math'
}
},
function (req, cb) {
function(req, cb) {
this.act(
{
topic: 'math',
cmd: 'sub',
a: req.a + req.b,
b: 100
},
function (err, res) {
function(err, res) {
cb(err, res)
}
)
Expand All @@ -64,7 +64,7 @@ hemera.ready(() => {
a: 100,
b: 200
},
function (err, resp) {
function(err, resp) {
console.log(resp)
}
)
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/async-await.js
Expand Up @@ -13,7 +13,7 @@ hemera.ready(() => {
topic: 'math',
cmd: 'add'
},
async function (req) {
async function(req) {
return await Promise.resolve('test')
}
)
Expand All @@ -25,7 +25,7 @@ hemera.ready(() => {
a: 10,
b: 10
},
async function (err, result) {
async function(err, result) {
this.log.info(await result)
}
)
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/async.js
Expand Up @@ -36,7 +36,7 @@ hemera.ready(() => {
hemera.act('topic:math,cmd:add,a:3,b:2', callback)
}
],
function (err, results) {
function(err, results) {
console.log(err, results)
}
)
Expand All @@ -52,7 +52,7 @@ hemera.ready(() => {
}

const add1and2 = compose(add1, add2)
add1and2(10, function (err, result) {
add1and2(10, function(err, result) {
console.log(err, result)
})

Expand Down
2 changes: 1 addition & 1 deletion examples/basic/client.js
Expand Up @@ -15,7 +15,7 @@ hemera.ready(() => {
a: 1,
b: 2
},
function (err, resp) {
function(err, resp) {
this.log.info(resp, 'Result')
}
)
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/custom-errors.js
Expand Up @@ -13,7 +13,7 @@ hemera.ready(() => {
topic: 'math',
cmd: 'add'
},
function (req, cb) {
function(req, cb) {
const err = new UnauthorizedError('Unauthorized action')
cb(err)
}
Expand All @@ -26,7 +26,7 @@ hemera.ready(() => {
a: 1,
b: 2
},
function (err, resp) {
function(err, resp) {
console.log(err instanceof UnauthorizedError)
}
)
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/custom-logger.js
Expand Up @@ -4,7 +4,7 @@ const Hemera = require('./../../packages/hemera')
const nats = require('nats').connect()

class Logger {
info (msg) {
info(msg) {
console.log(msg)
}
}
Expand All @@ -22,7 +22,7 @@ hemera.ready(() => {
a: 1,
b: 2
},
function (err, resp) {
function(err, resp) {
this.log.info(resp, 'Result')
}
)
Expand Down
12 changes: 6 additions & 6 deletions examples/basic/error-propagation.js
Expand Up @@ -13,19 +13,19 @@ hemera.ready(() => {
topic: 'a',
cmd: 'a'
},
function (resp, cb) {
function(resp, cb) {
this.act(
{
topic: 'b',
cmd: 'b'
},
function (err, resp) {
function(err, resp) {
this.act(
{
topic: 'c',
cmd: 'c'
},
function (err, resp) {
function(err, resp) {
cb(err, resp)
}
)
Expand All @@ -49,13 +49,13 @@ hemera.ready(() => {
topic: 'c',
cmd: 'c'
},
function (resp, cb) {
function(resp, cb) {
this.act(
{
topic: 'b',
cmd: 'b'
},
function (err, resp) {
function(err, resp) {
cb(err, resp)
}
)
Expand All @@ -67,7 +67,7 @@ hemera.ready(() => {
topic: 'a',
cmd: 'a'
},
function (err, resp) {
function(err, resp) {
this.log.info('Error name: %s', err.name)
this.log.info('Error message: %s', err.message)
this.log.info('Custom error data: test=%s', err.test)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/full-example.js
Expand Up @@ -25,7 +25,7 @@ hemera.ready(() => {
a: 1,
b: 20
},
function (err, resp) {
function(err, resp) {
this.log.info(resp, 'Result')
}
)
Expand Down
14 changes: 7 additions & 7 deletions examples/basic/generators.js
Expand Up @@ -14,18 +14,18 @@ hemera.ready(() => {
topic: 'math',
cmd: 'divide'
},
function (req, reply) {
function(req, reply) {
reply(null, {
result: req.a / req.b
})
}
)

hemera.ext('onServerPreRequest', function (ctx, req, res, next) {
hemera.ext('onServerPreRequest', function(ctx, req, res, next) {
next()
})

hemera.ext('onServerPreRequest', function * (ctx, req, res) {
hemera.ext('onServerPreRequest', function*(ctx, req, res) {
return yield Promise.resolve()
})

Expand All @@ -34,15 +34,15 @@ hemera.ready(() => {
topic: 'math',
cmd: 'sub'
},
function * (req) {
function*(req) {
var result = yield Promise.resolve({
result: req.a - req.b
})
return result
}
)

hemera.act('topic:math,cmd:divide,a:30,b:5', function (err, result) {
hemera.act('topic:math,cmd:divide,a:30,b:5', function(err, result) {
this.log.info(result)
})

Expand All @@ -51,7 +51,7 @@ hemera.ready(() => {
topic: 'math',
cmd: 'add'
},
function * (req) {
function*(req) {
const add = yield Promise.resolve({
result: req.a + req.b
})
Expand Down Expand Up @@ -80,7 +80,7 @@ hemera.ready(() => {
a: 10,
b: 10
},
function * (err, result) {
function*(err, result) {
return yield result
}
)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/graceful-shutdown.js
Expand Up @@ -11,7 +11,7 @@ const hemera = new Hemera(nats, {

hemera.use(HemeraGracefulShutdown)

hemera.ready(function () {
hemera.ready(function() {
hemera.ext('onClose', (ctx, next) => {
this.log.info('Triggered!')
next()
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/hemera-errors.js
Expand Up @@ -26,7 +26,7 @@ hemera.ready(() => {
cmd: 'add',
a: 'ddd'
},
function (err, resp) {
function(err, resp) {
this.log.debug(err instanceof Hemera.errors.BusinessError)
}
)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/nats-only.js
Expand Up @@ -15,7 +15,7 @@ const hemera = new Hemera(nats, {

hemera.ready(() => {
// Receive in NodeJs client
hemera.transport.subscribe('math', function (req) {
hemera.transport.subscribe('math', function(req) {
hemera.log.info(req)
})
// Publish from Golang client
Expand Down
12 changes: 6 additions & 6 deletions examples/basic/node-errors.js
Expand Up @@ -20,7 +20,7 @@ hemera.ready(() => {
topic: 'math',
cmd: 'div'
},
function (req, cb) {
function(req, cb) {
const bar = new FooBarError('bar')
bar.test = 'test'
const err = new FooBarError('foo').causedBy(bar)
Expand All @@ -33,7 +33,7 @@ hemera.ready(() => {
topic: 'math',
cmd: 'sub'
},
function (req, cb) {
function(req, cb) {
const err = new FooBarError().causedBy(new Error('test'))
cb(err)
}
Expand All @@ -44,7 +44,7 @@ hemera.ready(() => {
topic: 'math',
cmd: 'add'
},
function (req, cb) {
function(req, cb) {
const err = new Error('test')
cb(err)
}
Expand All @@ -55,7 +55,7 @@ hemera.ready(() => {
topic: 'math',
cmd: 'add'
},
function (err, resp) {
function(err, resp) {
this.log.debug('Instance of: %s', err instanceof Error)
this.log.debug('Error: %s', err.name)
this.log.debug('Error message: %s', err.message)
Expand All @@ -67,7 +67,7 @@ hemera.ready(() => {
topic: 'math',
cmd: 'sub'
},
function (err, resp) {
function(err, resp) {
this.log.debug('Instance of: %s', err instanceof Error)
this.log.debug('Error: %s', err.name)
this.log.debug('Error: %s', err.name)
Expand All @@ -80,7 +80,7 @@ hemera.ready(() => {
topic: 'math',
cmd: 'div'
},
function (err, resp) {
function(err, resp) {
this.log.debug('Instance of: %s', err instanceof FooBarError)
this.log.debug('Error: %s', err.name)
this.log.debug('Error data: %s', err.test)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/plugin-errors.js
Expand Up @@ -35,7 +35,7 @@ hemera.ready(() => {
cmd: 'add',
a: 'ddd'
},
function (err, resp) {
function(err, resp) {
this.log.debug(err instanceof joiErrors.PreValidationError)
}
)
Expand Down
8 changes: 4 additions & 4 deletions examples/basic/promise-retry.js
Expand Up @@ -22,12 +22,12 @@ hemera.ready(() => {
topic: 'math',
cmd: 'add'
},
function * (req, cb) {
function*(req, cb) {
return Promise.reject(new Error('Uuups!'))
}
)

promiseRetry(function (retry, number) {
promiseRetry(function(retry, number) {
console.log('Attempt number', number)

return hemera
Expand All @@ -39,10 +39,10 @@ hemera.ready(() => {
})
.catch(retry)
}, opt).then(
function (value) {
function(value) {
console.log(value)
},
function (err) {
function(err) {
console.error(err)
}
)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/server.js
Expand Up @@ -16,7 +16,7 @@ hemera.ready(() => {
topic: 'math',
cmd: 'add'
},
function (req, cb) {
function(req, cb) {
cb(null, req.a + req.b)
}
)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/streaming.js
Expand Up @@ -28,7 +28,7 @@ hemera.ready(() => {
cmd: 'add',
maxMessages$: -1
},
function (err, resp) {
function(err, resp) {
results.push(resp)
if (results.length === 1000) {
console.log('Received 1000 Messages!')
Expand Down

0 comments on commit a65e92c

Please sign in to comment.