UNPKG

367 BJavaScriptView Raw
1/*
2 Copyright 2012-2015, Yahoo Inc.
3 Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
4 */
5'use strict';
6
7module.exports = function percent(covered, total) {
8 let tmp;
9 if (total > 0) {
10 tmp = (1000 * 100 * covered) / total;
11 return Math.floor(tmp / 10) / 100;
12 } else {
13 return 100.0;
14 }
15};