I'm trying to build butter(https://github.com/butterproject/butter-desktop) but it don't compile because a code in hoek library:
/src/butter-desktop/node_modules/hawk/node_modules/hoek/lib/index.js:483
compare = (a, b) => a === b;
^
...
>> Unexpected token >
And there is others lines where this "operator" =>
is used, like:
const leftovers = ref.replace(regex, ($0, $1) => {
const index = values.indexOf($1);
++matches[index];
return ''; // Remove from string
});
I'm trying to understand, and I guess it's like a "function" operator...
If I got correct is something similar to:
On first code:
compare = (function(a, b) { return a === b; })(a,b);
that in this case is the same as
compare = a === b;
and on second code:
const leftovers = ref.replace(regex, (function($0, $1) {
const index = values.indexOf($1);
++matches[index];
return ''; // Remove from string
})($0, $1));
Anyone can confirm and give-me a official reference of this ?
The online code is: https://github.com/hapijs/hoek/blob/master/lib/index.js#L483