decimal.js
function truncate(arr, len) {
    if (arr.length > len) {
      arr.length = len;
      return true;
    }
  }
function truncate(arr, len) {
    if (arr.length > len) {
      arr.length = len;
      return true;
    }
  }
function truncate ( arr , len ) { if ( arr . length > len ) { arr . length = len ; return true ; } }
Does not strip trailing zeros.
Does not strip trailing zeros .