You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

subutil.js 400 B

2 jaren geleden
1234567891011121314151617181920212223
  1. var sub = function (val, lengths) {
  2. var length_val = val.length + '';
  3. if (length_val == 0 || val == undefined) {
  4. return;
  5. }
  6. if (length_val > lengths) {
  7. return val.substring(0, lengths) + "...";
  8. } else {
  9. return val;
  10. }
  11. };
  12. var subMore = function (val, lengths) {
  13. var val = val + '';
  14. return val.substring(0, lengths);
  15. };
  16. module.exports = {
  17. sub: sub,
  18. subMore: subMore
  19. };