mleibman/SlickGrid — pull request #587 by jgoz (2013-04-23 17:06:17+00:00)
Title: Improve `return` matching for inlined filter functions

*Note: Similar to #583.*

When inlining filter functions, SlickGrid expected return statements to be terminated by `;` or `}`, which could cause issues in projects that uglify as part of a build process due to semicolon stripping.

For instance, a developer could have written the following:

```js
function filter(o) {
if (o.val === 3) {
return true;
}
return false;
}
```

But the uglifier might rewrite it as this:

```js
function filter(o) { if (o.val === 3) { return true } return false }
```

Prior to the changes in this pull request, the uglified filter function would have had 2 dangling `return` statements in the resulting inlined version, which would generate invalid results during filtering.

The solution involves the following regex changes:
- Match semicolon, closing brace and end-of-input as valid return terminators (`([;}]|$)`)
- Preserve captured return terminator in inlined function (avoids brace mismatching)
- Tolerate arbitrary spacing before return terminators

Two test cases were added, one for absolute return statements (`return true|false`) and one for evaluated return statements (`return o.val === 3`).