Use arrow functions where appropriate

This commit is contained in:
Adam Goldsmith 2021-09-30 00:29:27 -04:00
parent 859b9822c5
commit 73ef5d97fb
2 changed files with 9 additions and 25 deletions

View File

@ -18,18 +18,10 @@ const RESOLUTION = 200;
const FORMAT = ImageUtils.FORMAT_JPEG; const FORMAT = ImageUtils.FORMAT_JPEG;
function getName() { const getName = () => 'TTSDeck';
return 'TTSDeck'; const getDescription = () => 'Generates a TTS deck image and JSON file';
} const getVersion = () => 1.0;
function getDescription() { const getPluginType = () => arkham.plugins.Plugin.INJECTED;
return 'Generates a TTS deck image and JSON file';
}
function getVersion() {
return 1.0;
}
function getPluginType() {
return arkham.plugins.Plugin.INJECTED;
}
function unload() { function unload() {
unregisterAll(); unregisterAll();
@ -40,9 +32,7 @@ testProjectScript();
// Hack to override the default return value of 1 // Hack to override the default return value of 1
function copyCount(copies_list, name) { function copyCount(copies_list, name) {
const entries = copies_list.getListEntries().map(function (x) { const entries = copies_list.getListEntries().map(x => String(x));
return String(x);
});
if (entries.indexOf(String(name)) == -1) { if (entries.indexOf(String(name)) == -1) {
return 2; return 2;
} else { } else {
@ -97,12 +87,8 @@ function makeTTSDeck(cards, copies_list) {
function run() { function run() {
const ttsDeckAction = JavaAdapter(TaskAction, { const ttsDeckAction = JavaAdapter(TaskAction, {
getLabel: function getLabel() { getLabel: () => 'Generate TTS Deck',
return 'Generate TTS Deck'; getActionName: () => 'ttsdeck',
},
getActionName: function getActionName() {
return 'ttsdeck';
},
// Applies to Deck Tasks // Applies to Deck Tasks
appliesTo: function appliesTo(project, task, member) { appliesTo: function appliesTo(project, task, member) {
if (member != null || task == null) { if (member != null || task == null) {
@ -135,7 +121,7 @@ function run() {
} }
const children = member.getChildren(); const children = member.getChildren();
const cards = children.filter(function (child) { const cards = children.filter(child => {
if (ProjectUtilities.matchExtension(child, 'eon')) { if (ProjectUtilities.matchExtension(child, 'eon')) {
let component = ResourceKit.getGameComponentFromFile(child.file); let component = ResourceKit.getGameComponentFromFile(child.file);
return component.isDeckLayoutSupported(); return component.isDeckLayoutSupported();

View File

@ -34,9 +34,7 @@ exports.makeCardJSON = function makeCardJSON(card_id, nickname, description) {
exports.makeDeckJSON = function makeDeckJSON( exports.makeDeckJSON = function makeDeckJSON(
face_url, back_url, num_width, num_height, cards, nickname, description) { face_url, back_url, num_width, num_height, cards, nickname, description) {
const deck_ids = cards.map(function (card) { const deck_ids = cards.map(card => card.CardID);
return card.CardID;
});
return { return {
Name: "DeckCustom", Name: "DeckCustom",
Transform: { Transform: {