fix(core): update
This commit is contained in:
1
ts/helpers/index.ts
Normal file
1
ts/helpers/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './tinkmath.js';
|
22
ts/helpers/tinkmath.ts
Normal file
22
ts/helpers/tinkmath.ts
Normal file
@ -0,0 +1,22 @@
|
||||
export interface ITinkScaledAmount {
|
||||
value: {
|
||||
unscaledValue: string;
|
||||
scale: string;
|
||||
};
|
||||
currencyCode: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a normalized amount
|
||||
* @param scaledArg
|
||||
* @returns
|
||||
*/
|
||||
export const getNormalizedAmount = (scaledArg?: ITinkScaledAmount) => {
|
||||
if (!scaledArg) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
amount: parseInt(scaledArg.value.unscaledValue) / (10 ^ parseInt(scaledArg.value.scale)),
|
||||
currency: 'EUR'
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user