source: imaps-frontend/node_modules/clean-css/lib/optimizer/level-1/value-optimizers/precision.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 748 bytes
Line 
1var plugin = {
2 level1: {
3 value: function precision(_name, value, options) {
4 if (!options.precision.enabled || value.indexOf('.') === -1) {
5 return value;
6 }
7
8 return value
9 .replace(options.precision.decimalPointMatcher, '$1$2$3')
10 .replace(options.precision.zeroMatcher, function(match, integerPart, fractionPart, unit) {
11 var multiplier = options.precision.units[unit].multiplier;
12 var parsedInteger = parseInt(integerPart);
13 var integer = Number.isNaN(parsedInteger) ? 0 : parsedInteger;
14 var fraction = parseFloat(fractionPart);
15
16 return Math.round((integer + fraction) * multiplier) / multiplier + unit;
17 });
18 }
19 }
20};
21
22module.exports = plugin;
Note: See TracBrowser for help on using the repository browser.