Skip to content

Commit

Permalink
new build
Browse files Browse the repository at this point in the history
  • Loading branch information
Knape committed Jan 20, 2017
1 parent f7cd3b5 commit d515185
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use strict';

Object.defineProperty(exports, "__esModule", {
value: true
});
var round = function round(type) {
return function (x, precision) {
if (typeof x !== 'number') {
throw new TypeError('Expected value to be a number');
}
return Number(Math[type](x + 'e' + Math.abs(precision)) + ('e-' + Math.abs(precision)));
};
};

var near = function near(type) {
return function (x, nearest) {
if (typeof x !== 'number') {
throw new TypeError('Expected value to be a number');
}
return Number(Math[type](x / nearest) * nearest);
};
};

var next = exports.next = near('ceil');
var prev = exports.prev = near('floor');
var up = exports.up = round('ceil');
var down = exports.down = round('floor');
exports.default = round('round');

0 comments on commit d515185

Please sign in to comment.