|
|
@ -9,9 +9,15 @@ const parse = v => {
|
|
|
|
} catch (e) {}
|
|
|
|
} catch (e) {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const escapeHtml = s =>
|
|
|
|
|
|
|
|
s
|
|
|
|
|
|
|
|
.replace(/</g, '<')
|
|
|
|
|
|
|
|
.replace(/>/g, '>')
|
|
|
|
|
|
|
|
.replace(/\//g, '/')
|
|
|
|
|
|
|
|
|
|
|
|
export const parseRGBA = obj => `rgba(${obj.r},${obj.g},${obj.b},${obj.a})`
|
|
|
|
export const parseRGBA = obj => `rgba(${obj.r},${obj.g},${obj.b},${obj.a})`
|
|
|
|
|
|
|
|
|
|
|
|
export const getState = morph.compose(parse, morph.get(KEY))
|
|
|
|
export const getState = morph.compose(parse, escapeHtml, morph.get(KEY))
|
|
|
|
export const saveState = (window, v) => assign(window, JSON.stringify(v))
|
|
|
|
export const saveState = (window, v) => assign(window, JSON.stringify(v))
|
|
|
|
|
|
|
|
|
|
|
|
export const capitalizeFirstLetter = s => s.charAt(0).toUpperCase() + s.slice(1)
|
|
|
|
export const capitalizeFirstLetter = s => s.charAt(0).toUpperCase() + s.slice(1)
|
|
|
|