Skip to content
This repository has been archived by the owner on Jan 5, 2019. It is now read-only.

Commit

Permalink
chore: lint and format
Browse files Browse the repository at this point in the history
Changes due to new lockfile
  • Loading branch information
eps1lon committed Apr 25, 2018
1 parent a3c4b49 commit 88ebae1
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 32 deletions.
14 changes: 7 additions & 7 deletions src/format/groupMods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ export type Options = {

/**
* tries to find a string that describes the given mods
*
*
* given a list of mods where a mod consists of at least one stat
* get a translation t of that mod and consider it a row
* split t into words and consider every word as a column
* collapse the table into a single row
* columns with different words get resolved by a given strategy
*
*
*
*
*
*
* Adds # to Fire Gems
* Adds # to Cold Gems
* ----
* Adds # to * Gems
*
* @param mods
* @param options
*
* @param mods
* @param options
*/
export default function groupMod(
mods: Stat[][],
Expand Down
13 changes: 6 additions & 7 deletions src/format/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ export default formatStats;

/**
* creates an array of methods that can be used to find a description for a
* given stat.
*
* given stat.
*
* return value is to be interpreted as a priority queue
* @param descriptions
* @param descriptions
*/
export function createDescriptionFindStrategies(
descriptions: Descriptions
Expand Down Expand Up @@ -132,10 +132,9 @@ function formatWithFinder(
);

if (translation === undefined) {
const requiredStatsAreZero = requiredStats(
description,
stats
).every(({ value }) => isZero(value));
const requiredStatsAreZero = requiredStats(description, stats).every(
({ value }) => isZero(value)
);

if (!requiredStatsAreZero) {
throw new Error(`matching translation not found for '${stat.id}'`);
Expand Down
17 changes: 8 additions & 9 deletions src/format/textToStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
Translation,
UnaryFormatter
} from '../types/StatDescription';
import NamedGroupsRegexp from '../util/NamedGroupsRegexp';
import { deterministicValueForMatcher } from '../util/symbolicStats';
import { getDescriptions } from './util';

Expand All @@ -18,10 +17,10 @@ export type Options = {

/**
* finds every stat or list of stats that could produce this text with its values
*
*
* use {textToStatsSingle} if you just want the first match
* use {textToStatsArray} if you want the generator values as an array
*
*
* @param text the stat text
* @param options see type definition
*/
Expand Down Expand Up @@ -90,19 +89,19 @@ export default function* textToStats(

/**
* @see {textToStats} as array
*
* @param text
* @param options
*
* @param text
* @param options
*/
export function textToStatsArray(text: string, options: Partial<Options> = {}) {
return Array.from(textToStats(text, options));
}

/**
* only first match of @see {textToStats} but throws if none was found
*
* @param text
* @param options
*
* @param text
* @param options
*/
export function textToStatsFirst(
text: string,
Expand Down
6 changes: 3 additions & 3 deletions src/localize/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ export default function factory(

/**
* orders the given values so that the smallest displayed is min
*
*
* reduced stats are given as negative values and then negated for display
* whichs results in [-30, -15] being displayed as "(30 - 15) reduced"
* @param param0
*
* @param param0
*
*/
function valueOrder(
[left, right]: [number, number],
Expand Down
4 changes: 2 additions & 2 deletions src/translate/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default function translate(
description: Description,
provided: Map<string, Stat>,
/**
* @param t
* @param count {number} number of params
* @param t
* @param count {number} number of params
*/
getFormatters: (
t: Translation,
Expand Down
11 changes: 7 additions & 4 deletions src/util/NamedGroupsRegexp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ export default class NamedGroupsRegexp {
throw new Error('named groups count did not match matched groups count');
}

return match.slice(1).reduce((named, matched, i) => {
named[this.groups[i]] = matched;
return match.slice(1).reduce(
(named, matched, i) => {
named[this.groups[i]] = matched;

return named;
}, {} as { [key: string]: string });
return named;
},
{} as { [key: string]: string }
);
}

public toString() {
Expand Down

0 comments on commit 88ebae1

Please sign in to comment.