Use arrow funcs where possible.

This commit is contained in:
Julien Fontanet 2015-12-28 10:18:21 +01:00
parent faf5ff6aa4
commit a6e18819d4

View File

@ -8,24 +8,20 @@ import { readFile } from 'fs-promise'
// =================================================================== // ===================================================================
function bind (fn, thisArg) { const bind = (fn, thisArg) => function () {
return function () { return fn.apply(thisArg, arguments)
return fn.apply(thisArg, arguments)
}
} }
const VAR_RE = /\{\{([^}]+)\}\}/g const VAR_RE = /\{\{([^}]+)\}\}/g
function evalFilter (filter, vars) { const evalFilter = (filter, vars) => filter.replace(VAR_RE, (_, name) => {
return filter.replace(VAR_RE, (_, name) => { const value = vars[name]
const value = vars[name]
if (value === undefined) { if (value === undefined) {
throw new Error('invalid variable: ' + name) throw new Error('invalid variable: ' + name)
} }
return escape(value) return escape(value)
}) })
}
export const configurationSchema = { export const configurationSchema = {
type: 'object', type: 'object',