I have jquery which does some filtering in my project. when I run the project locally it works fine. so when I run gulp --production
it's giving the error like this
SyntaxError: Unexpected token: operator (>)'
$(document).on('click', 'input.ConfigBundleCheckbox', function(e) {
$('.assetIDConfig').hide()
.filter(function() {
var checkedItems = [];
$(".ConfigBundleCheckbox:checked").each(function(e) {
checkedItems.push(parseInt(this.value));
});
var x = JSON.parse("[" + $(this).data("category") + "]");
var y = checkedItems;
var found = y.reduce((included, num) => included && x.includes(num), true);
if (!checkedItems.length) {
return true;
} else {
return found;
}
}).show();
});
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<table class="baseTable JobTable table text-center table-stripped table-bordered">
<thead>
<tr>
<th style="text-align: center">Select</th>
<th style="text-align: center">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center">
<input type="checkbox" name="filterCheck1" value="9" id="9" class="js-switch ConfigBundleCheckbox">
</td>
<td>
Planer Operator
</td>
</tr>
<tr>
<td style="text-align: center">
<input type="checkbox" name="filterCheck2" value="10" id="10" class="js-switch ConfigBundleCheckbox">
</td>
<td>
Banksman
</td>
</tr>
</tbody>
</table>
<table class="ConfigTable JobTable table text-center table-stripped table-bordered">
<thead>
<tr>
<th style="text-align: center">Description</th>
<th></th>
</tr>
</thead>
<tbody class="ConfigMatch">
<tr class="assetIDConfig" data-category="11,9">
<td>
Planer with Operator
</td>
<td style="text-align: center">
<button data-bundleid="5" class="btn btn-primary btn-sm">Select</button>
</td>
</tr>
<tr class="assetIDConfig" data-category="11,9,10">
<td>
Planer with Operator and Banksman
</td>
<td style="text-align: center">
<button data-bundleid="6" class="btn btn-primary btn-sm">Select</button>
</td>
</tr>
</tbody>
</table>
In the above jquery code, it says there is a syntax error at the line
var found = y.reduce((included, num) => included && x.includes(num), true);
But I m not getting what's the syntax error in that line so I checked the syntax error using this website http://jshint.com/
and it says
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
I'm not getting what I need to do ? can somebody help me with this issue how to alter this line to achieve my results?
My gulpfile.js
contents:
const elixir = require('laravel-elixir');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Sass
| file for our application, as well as publishing vendor resources.
|
*/
elixir(mix => {
mix.sass('app.scss');
mix.copy('resources/assets/vendor/bootstrap/fonts', 'public/fonts');
mix.copy('resources/assets/vendor/font-awesome/fonts', 'public/fonts')
mix.styles([
'resources/assets/vendor/bootstrap/css/bootstrap.css',
'resources/assets/vendor/animate/animate.css',
'resources/assets/vendor/font-awesome/css/font-awesome.css',
'resources/assets/css/plugins/dataTables/datatables.min.css',
'resources/assets/css/plugins/bootstrap-datepicker/bootstrap-datepicker.css',
'resources/assets/css/plugins/select2/select2.min.css',
'resources/assets/css/plugins/gridForm/gridforms.css',
'resources/assets/css/plugins/iCheck/custom.css',
'resources/assets/css/plugins/bootstrap-tagsinput/bootstrap-tagsinput.css',
'resources/assets/css/plugins/switchery/switchery.css',
'resources/assets/css/plugins/ladda/ladda-themeless.min.css',
'resources/assets/css/plugins/dropzone/basic.css',
'resources/assets/css/plugins/dropzone/dropzone.css',
// 'resources/assets/css/plugins/fullcalendar/fullcalendar.css',
// 'resources/assets/css/plugins/fullcalendar/fullcalendar.print.css',
'resources/assets/css/plugins/sweetalert/sweetalert.css',
'resources/assets/css/custom_style.css'
], 'public/css/vendor.css', './');
mix.scripts([
'resources/assets/vendor/jquery/jquery-3.1.1.min.js',
'resources/assets/js/plugins/dataTables/datatables.min.js',
'resources/assets/js/plugins/dataTables/dataTables.rowsGroup.js',
'resources/assets/js/plugins/dataTables/dataTables.fixedColumns.min.js',
// 'resources/assets/js/plugins/fullcalendar/moment.min.js',
'resources/assets/vendor/bootstrap/js/bootstrap.js',
'resources/assets/js/plugins/datapicker/bootstrap-datepicker.js',
'resources/assets/vendor/metisMenu/jquery.metisMenu.js',
'resources/assets/vendor/slimscroll/jquery.slimscroll.min.js',
'resources/assets/vendor/pace/pace.min.js',
'resources/assets/js/plugins/select2/select2.min.js',
'resources/assets/js/plugins/gridForm/gridforms.js',
'resources/assets/js/plugins/bootstrap-tagsinput/bootstrap-tagsinput.js',
'resources/assets/js/plugins/dropzone/dropzone.js',
'resources/assets/js/plugins/iCheck/icheck.min.js',
'resources/assets/js/plugins/switchery/switchery.js',
'resources/assets/js/plugins/typehead/bootstrap3-typeahead.min.js',
// 'resources/assets/js/plugins/jquery-ui/jquery-ui.min.js',
//'resources/assets/js/plugins/fullcalendar/fullcalendar.min.js',
'resources/assets/js/plugins/sparkline/jquery.sparkline.min.js',
'resources/assets/js/plugins/peity/jquery.peity.min.js',
'resources/assets/js/custom.js',
'resources/assets/js/plugins/sweetalert/sweetalert.min.js',
'resources/assets/js/plugins/ladda/spin.min.js',
'resources/assets/js/plugins/ladda/ladda.min.js',
'resources/assets/js/plugins/ladda/ladda.jquery.min.js',
'resources/assets/js/app.js'
], 'public/js/app.js', './');
});
Any suggestions, Please!