Replace AMAP var by const.

This commit is contained in:
Julien Fontanet 2015-04-22 14:10:04 +02:00
parent fe3ce45b8e
commit 1a89465201
3 changed files with 12 additions and 11 deletions

View File

@ -49,7 +49,7 @@ function checkPermission (method) {
// -------------------------------------------------------------------
function checkParams (method, params) {
var schema = method.params
const schema = method.params
if (!schema) {
return
}
@ -140,7 +140,7 @@ checkAuthorization = Bluebird.method(function (userId, object) {
})
function resolveParams (method, params) {
var resolve = method.resolve
const resolve = method.resolve
if (!resolve) {
return params
}

View File

@ -99,7 +99,7 @@ export default class Collection extends EventEmitter {
}
update (models) {
var array = isArray(models)
const array = isArray(models)
if (!isArray(models)) {
models = [models]
}
@ -120,7 +120,7 @@ export default class Collection extends EventEmitter {
throw new Error('a model without an id cannot be updated')
}
var error = model.validate()
const error = model.validate()
if (error !== undefined) {
// TODO: Better system inspired by Backbone.js.
throw error

View File

@ -83,14 +83,15 @@ const loadConfiguration = coroutine(function * () {
const loadPlugin = Bluebird.method(function (pluginConf, pluginName) {
debugPlugin('loading %s', pluginName)
var pluginPath
try {
pluginPath = require.resolve('xo-server-' + pluginName)
} catch (e) {
pluginPath = require.resolve(pluginName)
}
const pluginPath = (function (name) {
try {
return require.resolve('xo-server-' + name)
} catch (e) {
return require.resolve(name)
}
})(pluginName)
var plugin = require(pluginPath)
let plugin = require(pluginPath)
if (isFunction(plugin)) {
plugin = plugin(pluginConf)