Skip to content

Commit

Permalink
Remove unused function.
Browse files Browse the repository at this point in the history
All uses of parseAndFormat specify both input and parseFn. Simplify parameter list to reflect that.
  • Loading branch information
tobli committed Aug 24, 2017
1 parent 2f4b2f7 commit 966a12f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/ts/helpers/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { roundNumber } from "./misc";
* @param formatFn an optional function to format the parsed input value.
* @returns {string} a formatted string representation of the input, or undefined.
*/
export function parseAndFormat<S, T>(input?: S,
parseFn: ((_: S) => T) = identity,
export function parseAndFormat<S, T>(input: S,
parseFn: ((_: S) => T),
formatFn: ((_: T) => string) = toString): string {
if (input === undefined) {
return undefined;
Expand All @@ -23,11 +23,6 @@ export function parseAndFormat<S, T>(input?: S,
return formatFn(parsed);
}

/** Fallback dummy function - just maintains the type */
function identity<T>(source: T): T {
return source;
}

function toString<T>(source: T): string {
if (typeof source["toString"] === "function") {
return source.toString();
Expand Down

0 comments on commit 966a12f

Please sign in to comment.