I need to reread how the arrow works I guess.
It's not a matter of how arrow functions work, it's a matter of the syntax simply doesn't exist in older browsers. My usual advice is to write code that works in all browsers supported by the story format you're using—and SugarCube supports browsers that don't understand any ES2015 syntax features.
Whether or not your player pool will include anyone who uses such a browser, I couldn't say.
if (conflicts.some(function(r) {
return Slots.includes(r)}))
would be the expanded version correct?
Yes. Though, I'm not a fan of omitting the semi-colon at the end of the return statement.
Additionally. As I look back at the code again, you only use conflicts and Slots for that one test, so you really don't need to store either. Just store the results of the test. For example:
var $list = $(document.createDocumentFragment());
var hasConflict = Object.keys(character.clothing)
.filter(function (key) {
return character.clothing[key];
})
.some(function (slot) {
return clothing.clothingType.includes(slot);
});
if (hasConflict) {
Finally. As I look back at the code again, I've noticed something that I hadn't before. Your calls to this.error() really should terminate/exit the handler, however, as far as I can see, you're not doing that anywhere. For example, calls like the following:
this.error("…");
Should instead be something like:
return this.error("…");