Use arrow funcs where possible.
This commit is contained in:
parent
faf5ff6aa4
commit
a6e18819d4
@ -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',
|
||||||
|
Loading…
Reference in New Issue
Block a user