AI销管
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.
 
 
 
 

23 line
400 B

  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. };