Skip to content

Commit

Permalink
fix(strings): rename number parsers
Browse files Browse the repository at this point in the history
- rename to `maybeParseInt` / `maybeParseFloat`
  • Loading branch information
postspectacular committed Sep 24, 2018
1 parent 888ea74 commit 8cbfb97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/strings/src/parse.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const parseInt = (x: string, defaultVal = 0, radix = 10) => {
export const maybeParseInt = (x: string, defaultVal: any = 0, radix = 10) => {
const n = parseInt(x, radix);
return isNaN(n) ? defaultVal : n;
};

export const parseFloat = (x: string, defaultVal = 0) => {
export const maybeParseFloat = (x: string, defaultVal: any = 0) => {
const n = parseFloat(x);
return isNaN(n) ? defaultVal : n;
};

0 comments on commit 8cbfb97

Please sign in to comment.