Commit 2ccb8d55 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt

map falsy values to empty strings in simple template string renderer

parent 534a6da2
export const oneOf = values => value => values.indexOf(value) !== -1
export const renderSimpleTemplateString = (str, ctx) => {
return str.replace(/\{([a-z_]+)\}/gi, (match, key) => ctx[key])
return str.replace(/\{([a-z_]+)\}/gi, (match, key) => ctx[key] || '')
}
export const clamp = (value, min, max) => Math.min(max, Math.max(min, value))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment