- Partage méthode pour label des types
- Methode joining pour concaténation
- suppression template obsolete
- Déplacement de singleton rencontre dans game.system.rdd
- init des commandes lazy
This commit is contained in:
Vincent Vandemeulebrouck
2022-11-28 16:00:49 +01:00
parent dd4484c17b
commit e35f77b5a8
8 changed files with 118 additions and 104 deletions

View File

@ -24,7 +24,7 @@ export class Misc {
}
static sum() {
return (a, b) => a + b;
return (a, b) => Number(a) + Number(b);
}
static ascending(orderFunction = x => x) {
@ -41,6 +41,10 @@ export class Misc {
return 0;
}
static typeName(type, subType) {
return game.i18n.localize(`${type.toUpperCase()}.Type${Misc.upperFirst(subType)}`);
}
/**
* Converts the value to an integer, or to 0 if undefined/null/not representing integer
* @param {*} value value to convert to an integer using parseInt
@ -102,7 +106,11 @@ export class Misc {
}
static join(params, separator = '') {
return params?.reduce((a, b) => a + separator + b) ?? '';
return params?.reduce(Misc.joining(separator)) ?? '';
}
static joining(separator = '') {
return (a, b) => a + separator + b;
}
static connectedGMOrUser(ownerId = undefined) {