index.js
function precBase(base, value, precision) {
	const val = value.toString(base);
	const floatingPoint = val.indexOf('.');
	if (precision === 0 && floatingPoint > -1) {
		return val.substring(0, floatingPoint);//Node version > 0.10.*
	}
	if (floatingPoint === -1) {
		return val;
	}
	if (val.length - floatingPoint > precision) {
		return val.substring(0, floatingPoint + precision + 1);
	}
}
function precBase(base, value, precision) {
	const val = value.toString(base);
	const floatingPoint = val.indexOf('.');
	if (precision === 0 && floatingPoint > -1) {
		return val.substring(0, floatingPoint);//Node version > 0.10.*
	}
	if (floatingPoint === -1) {
		return val;
	}
	if (val.length - floatingPoint > precision) {
		return val.substring(0, floatingPoint + precision + 1);
	}
}
function precBase ( base , value , precision ) { const val = value . toString ( base ) ; const floatingPoint = val . indexOf ( '.' ) ; if ( precision === 0 && floatingPoint > - 1 ) { return val . substring ( 0 , floatingPoint ) ; //Node version > 0.10.* } if ( floatingPoint === - 1 ) { return val ; } if ( val . length - floatingPoint > precision ) { return val . substring ( 0 , floatingPoint + precision + 1 ) ; } }
Converts the given value to the new numeric base and truncates the precision to the given value.
@param  {Number} base Should follow the restrictions of Number.prototype.toString()
@param  {Number} value
@param  {Number} precision
@return {String}
Converts the given value to the new numeric base and truncates the precision to the given value .