Utils.js 408 Bytes
Newer Older
d.arizona's avatar
d.arizona committed
1 2 3 4 5 6 7
export function titleCase(text) {
	var value = String(text).replace(/\./g, ' ')
		.replace(/\s/g, ' ')
		.replace(/^(.)/, function($1) { return $1.toUpperCase(); })
		// .replace(/\s(.)/g, function($1) { return $1.toUpperCase(); })

	return value
syadziy's avatar
syadziy committed
8 9 10 11 12
}

export function roundMath(number, decimalPlaces) {
	const factorOfTen = Math.pow(10, decimalPlaces)
  	return Math.round(number * factorOfTen) / factorOfTen
d.arizona's avatar
d.arizona committed
13
}