mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
start upgrading eslint
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { last } from 'lodash';
|
||||
import shared from '../../../common';
|
||||
import { model as User } from '../../models/user';
|
||||
import { last } from 'lodash';
|
||||
|
||||
// Build a list of gear items owned by default
|
||||
const defaultOwnedGear = {};
|
||||
@@ -14,7 +14,7 @@ Object.keys(shared.content.gear.flat).forEach(key => {
|
||||
|
||||
export function getDefaultOwnedGear () {
|
||||
// Clone to avoid modifications to the original object
|
||||
return Object.assign({}, defaultOwnedGear);
|
||||
return { ...defaultOwnedGear };
|
||||
}
|
||||
|
||||
// When passed a path to an item in the user object it'll return true if
|
||||
@@ -62,18 +62,18 @@ export function validateItemPath (itemPath) {
|
||||
// will be converted to the number 5
|
||||
export function castItemVal (itemPath, itemVal) {
|
||||
if (
|
||||
itemPath.indexOf('items.pets') === 0 ||
|
||||
itemPath.indexOf('items.eggs') === 0 ||
|
||||
itemPath.indexOf('items.hatchingPotions') === 0 ||
|
||||
itemPath.indexOf('items.food') === 0 ||
|
||||
itemPath.indexOf('items.quests') === 0
|
||||
itemPath.indexOf('items.pets') === 0
|
||||
|| itemPath.indexOf('items.eggs') === 0
|
||||
|| itemPath.indexOf('items.hatchingPotions') === 0
|
||||
|| itemPath.indexOf('items.food') === 0
|
||||
|| itemPath.indexOf('items.quests') === 0
|
||||
) {
|
||||
return Number(itemVal);
|
||||
}
|
||||
|
||||
if (
|
||||
itemPath.indexOf('items.mounts') === 0 ||
|
||||
itemPath.indexOf('items.gear.owned') === 0
|
||||
itemPath.indexOf('items.mounts') === 0
|
||||
|| itemPath.indexOf('items.gear.owned') === 0
|
||||
) {
|
||||
if (itemVal === 'true') return true;
|
||||
if (itemVal === 'false') return false;
|
||||
@@ -82,4 +82,4 @@ export function castItemVal (itemPath, itemVal) {
|
||||
}
|
||||
|
||||
return itemVal;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user