From 966a12fc76d09bd12d8828f9c8afb8e667ddb959 Mon Sep 17 00:00:00 2001 From: Tobias Lidskog Date: Tue, 22 Aug 2017 13:39:02 +0200 Subject: [PATCH] Remove unused function. All uses of parseAndFormat specify both input and parseFn. Simplify parameter list to reflect that. --- src/ts/helpers/parse.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/ts/helpers/parse.ts b/src/ts/helpers/parse.ts index 608ee10d..f402a2e1 100644 --- a/src/ts/helpers/parse.ts +++ b/src/ts/helpers/parse.ts @@ -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(input?: S, - parseFn: ((_: S) => T) = identity, +export function parseAndFormat(input: S, + parseFn: ((_: S) => T), formatFn: ((_: T) => string) = toString): string { if (input === undefined) { return undefined; @@ -23,11 +23,6 @@ export function parseAndFormat(input?: S, return formatFn(parsed); } -/** Fallback dummy function - just maintains the type */ -function identity(source: T): T { - return source; -} - function toString(source: T): string { if (typeof source["toString"] === "function") { return source.toString();