Bug Tracker

Ticket #1451 (closed bug: wontfix)

Opened 1 year ago

Last modified 1 year ago

Boolean expression or conditional operator

Reported by: hobbit Assigned to: anonymous
Type: bug Priority: minor
Milestone: 1.2.1 Component: core
Version: 1.2 Keywords:
Cc: Needs: Review

Description

trim: function(t){
  return (t||"").replace(/^\s+|\s+$/g, "");
}

The following expression is shorter and faster.

trim: function(t){
  return t?t.replace(/^\s+|\s+$/g, ""):"";
}

Attachments

Change History

Changed 1 year ago by john

  • status changed from new to closed
  • version changed from 1.1.3 to 1.2
  • resolution set to wontfix
  • milestone changed from 1.1.4 to 1.2.1
Note: See TracTickets for help on using tickets.