var sub = function (val, lengths) {
  var length_val = val.length + '';

  if (length_val == 0 || val == undefined) {
    return;
  }

  if (length_val > lengths) {
    return val.substring(0, lengths) + "...";
  } else {
    return val;
  }
};

var subMore = function (val, lengths) {
  var val = val + '';
  return val.substring(0, lengths);
};

module.exports = {
  sub: sub,
  subMore: subMore
};