Replace AMAP var
by const
.
This commit is contained in:
parent
fe3ce45b8e
commit
1a89465201
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
15
src/index.js
15
src/index.js
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user