Skip to content

Commit

Permalink
PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hejkal committed Oct 28, 2024
1 parent ce0b6e8 commit 06cdca7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// License: LGPL-3.0-or-later
import JsonStringParser from './JsonStringParser';
const R = require('ramda');
const { getDefaultAmounts } = require('../../custom_amounts');
import { splitParam } from '..';

Expand All @@ -11,12 +10,12 @@ export interface CustomAmount {
highlight: string;
}

export default function parseCustomFields(amountsString: string): Amount[] {
export default function parseCustomAmounts(amountsString: string): Amount[] {
const defaultAmts = getDefaultAmounts().join();

if (amountsString.includes('{')) {
return new JsonStringParser(`[${amountsString}]`).results;
} else {
return R.compose(R.map(Number), splitParam)(amountsString || defaultAmts);
return splitParam(amountsString || defaultAmts).map(Number);
}
}
2 changes: 1 addition & 1 deletion client/js/nonprofits/donate/parseFields/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// License: LGPL-3.0-or-later
export {default as parseCustomField, CustomFieldDescription} from "./customField";
export {default as parseCustomFields} from "./customFields";
export {default as parseCustomAmounts} from './customAmounts';
export {default as parseCustomAmounts, CustomAmount, Amount} from './customAmounts';

export function splitParam(param:string) : string[] {
return param.split(/[_;,]/);
Expand Down

0 comments on commit 06cdca7

Please sign in to comment.