Commit 9964c6e5e9636cdc8b3f37a5cda9e898425b9583
Round numbers
Rômulo Alves committed on 8/30/2018, 4:43:28 PMParent: 803af62eca94e1a31162f52261b03aacd31cd8b2
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -1,8 +1,12 @@ | ||
1 | 1 … | |
2 | 2 … | const NAME_REGEX = /^([a-z0-9\-.\/ ]+)$/i // eslint-disable-line |
3 | 3 … | const MULTIPLIER_REGEX = /^(.*?)\s+x\s+(\d+)$/ |
4 | 4 … | |
5 … | +function round(value) { | |
6 … | + return Math.round(value * 100) / 100 | |
7 … | +} | |
8 … | + | |
5 | 9 … | module.exports = class Plainbudget { |
6 | 10 … | |
7 | 11 … | static computeSheet (sheet) { |
8 | 12 … | const pb = new Plainbudget(sheet) |
@@ -257,8 +261,10 @@ | ||
257 | 261 … | } |
258 | 262 … | } |
259 | 263 … | } |
260 | 264 … | |
265 … | + value = round(value) | |
266 … | + | |
261 | 267 … | if (group[0][0] === '=') { |
262 | 268 … | group[0][1] = value |
263 | 269 … | this.setNamed(group[0][2], value) |
264 | 270 … | } else { |
Built with git-ssb-web