@triviumcapital/trivium-ts-sdk
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -13,3 +13,2 @@ import type { Configuration } from './configuration'; | ||
'earningsToDate': EarningsToDate; | ||
'localDepositInstructions'?: LocalTransfer; | ||
'depositInstructions': DepositInstructions; | ||
@@ -81,4 +80,3 @@ } | ||
'currencyCode': string; | ||
'transferDetails'?: TransferDetails; | ||
'transfer'?: Transfer; | ||
'transfer': Transfer; | ||
} | ||
@@ -85,0 +83,0 @@ export interface EarningsToDate { |
@@ -92,6 +92,39 @@ "use strict"; | ||
return needsSerialization | ||
? JSON.stringify(value !== undefined ? value : {}) | ||
? JSON.stringify(value !== undefined ? convertMapsAndSetsToPlain(value) : {}) | ||
: (value || ""); | ||
}; | ||
exports.serializeDataIfNeeded = serializeDataIfNeeded; | ||
function convertMapsAndSetsToPlain(value) { | ||
if (typeof Set === "undefined") | ||
return value; | ||
if (typeof Map === "undefined") | ||
return value; | ||
if (typeof value !== "object" || !value) { | ||
return value; | ||
} | ||
if (value instanceof Set) { | ||
return Array.from(value).map(item => convertMapsAndSetsToPlain(item)); | ||
} | ||
if (value instanceof Map) { | ||
const entries = []; | ||
value.forEach((value, key) => { | ||
entries.push([key, convertMapsAndSetsToPlain(value)]); | ||
}); | ||
return objectFromEntries(entries); | ||
} | ||
if (Array.isArray(value)) { | ||
return value.map(it => convertMapsAndSetsToPlain(it)); | ||
} | ||
return objectFromEntries(objectEntries(value) | ||
.map(([k, v]) => [k, convertMapsAndSetsToPlain(v)])); | ||
} | ||
function objectEntries(object) { | ||
return Object.keys(object).map(key => [key, object[key]]); | ||
} | ||
function objectFromEntries(entries) { | ||
return [...entries].reduce((object, [key, val]) => { | ||
object[key] = val; | ||
return object; | ||
}, {}); | ||
} | ||
const toPathString = function (url) { | ||
@@ -98,0 +131,0 @@ return url.pathname + url.search + url.hash; |
{ | ||
"name": "@triviumcapital/trivium-ts-sdk", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Typescript Axios Client SDK for trivium APIs", | ||
@@ -5,0 +5,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82505
1334