mleibman/SlickGrid — Issue #301: failed to compile filter functions after minifier (at slick.dataview.js)
Author: SQReder
Created: 2012-03-09 12:09:26+00:00
State: open

Simple filter function
```javascript
var filter = function(item, args){
if (item.status != args.status) return false;
return true;
};
```
Minified
```javascript
if(f.status!=e.status){return false}return true
```

and after replacing return statements at compileFilter() and compileFilterWithCaching() functions
```javascript
if(f.status!=e.status){{ continue _coreloop; }return true
```
Voila! We've get invalid js code.

Fast fix for me - remove [;}] from regexp at
```javascript
var filterBody = filterInfo.body
.replace(/return false[;}]/gi, "{ continue _coreloop; }")
.replace(/return true[;}]/gi, "{ _retval[_idx++] = $item$; continue _coreloop; }")
.replace(/return ([^;}]+?);/gi,
"{ if ($1) { _retval[_idx++] = $item$; }; continue _coreloop; }");
```