JAVASCRIPT   683

trim.js

Guest on 27th August 2021 01:27:17 AM

  1. define(['../lang/toString', './WHITE_SPACES', './ltrim', './rtrim'], function(toString, WHITE_SPACES, ltrim, rtrim){
  2.     /**
  3.      * Remove white-spaces from beginning and end of string.
  4.      */
  5.     function trim(str, chars) {
  6.         str = toString(str);
  7.         chars = chars || WHITE_SPACES;
  8.         return ltrim(rtrim(str, chars), chars);
  9.     }
  10.  
  11.     return trim;
  12. });

Raw Paste


Login or Register to edit or fork this paste. It's free.