@daysnap/utils
Version: 
20 lines (18 loc) • 355 B
JavaScript
// src/stringTrim.ts
function stringTrim(str, type = 1) {
  switch (type) {
    case 1:
      return str.replace(/\s+/g, "");
    case 2:
      return str.replace(/(^\s*)|(\s*$)/g, "");
    case 3:
      return str.replace(/(^\s*)/g, "");
    case 4:
      return str.replace(/(\s*$)/g, "");
    default:
      return str;
  }
}
export {
  stringTrim
};