1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-08 22:15:02 +00:00
mon-entreprise/source/utils.js
mama b1f446da4d 🐛 Certains navigateurs ne sont pas encore internationalisés
Intl fait planter Safari sur certains iphones, e.g. le 6
2018-02-05 20:52:32 +01:00

14 lines
481 B
JavaScript

export let capitalise0 = name => name[0].toUpperCase() + name.slice(1)
export let getUrl = () => window.location.href.toString()
export let getIframeOption = optionName => {
let url = getUrl(),
hasOption = url.includes(optionName + '=')
return hasOption && url.split(optionName + '=')[1].split('&')[0]
}
export let fmt =
'Intl' in window ? new Intl.NumberFormat('fr-FR').format : v => v
export let humanFigure = decimalDigits => value =>
fmt(value.toFixed(decimalDigits))