Apply template string transform.

This commit is contained in:
John-David Dalton
2017-01-06 18:02:01 -08:00
parent 41ad5e901f
commit 4c881b2726
24 changed files with 132 additions and 132 deletions

View File

@@ -20,11 +20,11 @@ function createRound(methodName) {
if (precision) {
// Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details.
var pair = (toString(number) + 'e').split('e'),
value = func(pair[0] + 'e' + (+pair[1] + precision));
var pair = `${ toString(number) }e`.split('e'),
value = func(`${ pair[0] }e${ +pair[1] + precision }`);
pair = (toString(value) + 'e').split('e');
return +(pair[0] + 'e' + (+pair[1] - precision));
pair = `${ toString(value) }e`.split('e');
return +`${ pair[0] }e${ +pair[1] - precision }`;
}
return func(number);
};