@narative/oanda-v20
Advanced tools
Comparing version 3.0.42 to 3.0.43
{ | ||
"name": "@narative/oanda-v20", | ||
"description": "OANDA v20 bindings for Javascript", | ||
"version": "3.0.42", | ||
"version": "3.0.43", | ||
"author": "OANDA Corporation", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/narative/v20-javascript", |
@@ -44,2 +44,13 @@ "use strict"; | ||
Definition.prototype.toJSON = function () { | ||
var recursiveConvert = function (value) { | ||
if (value.toJSON) { | ||
return value.toJSON(); | ||
} | ||
else if (Array.isArray(value)) { | ||
return value.map(function (v) { return recursiveConvert(v); }); | ||
} | ||
else { | ||
return value; | ||
} | ||
}; | ||
return Object.entries(this) | ||
@@ -52,3 +63,3 @@ .filter(function (_a) { | ||
var k = _a[0], v = _a[1]; | ||
acc[k] = v.toJSON ? v.toJSON() : v; | ||
acc[k] = recursiveConvert(v); | ||
return acc; | ||
@@ -73,6 +84,4 @@ }, {}); | ||
var matches = summaryStr.match(re); | ||
console.log('AAAAA', matches); | ||
for (var _i = 0, _a = matches || []; _i < _a.length; _i++) { | ||
var match = _a[_i]; | ||
console.log('BBBBBBB', match); | ||
var key = match.slice(1, -1); | ||
@@ -79,0 +88,0 @@ var value = this[key] || match; |
{ | ||
"name": "@narative/oanda-v20", | ||
"description": "OANDA v20 bindings for Javascript", | ||
"version": "3.0.42", | ||
"version": "3.0.43", | ||
"author": "OANDA Corporation", | ||
@@ -31,2 +31,2 @@ "repository": "https://github.com/narative/v20-javascript", | ||
} | ||
} | ||
} |
@@ -46,6 +46,15 @@ export class Property { | ||
public toJSON() { | ||
const recursiveConvert = (value: any) => { | ||
if (value.toJSON) { | ||
return value.toJSON() | ||
} else if (Array.isArray(value)) { | ||
return value.map((v) => recursiveConvert(v)) | ||
} else { | ||
return value | ||
} | ||
} | ||
return Object.entries(this) | ||
.filter(([k, v]) => !['_summaryFormat', '_nameFormat', '_properties'].includes(k)) | ||
.reduce((acc, [k, v]) => { | ||
acc[k] = v.toJSON ? v.toJSON() : v | ||
acc[k] = recursiveConvert(v) | ||
return acc | ||
@@ -80,6 +89,3 @@ }, {}) | ||
console.log('AAAAA', matches) | ||
for (let match of matches || []) { | ||
console.log('BBBBBBB', match) | ||
let key = match.slice(1, -1) | ||
@@ -86,0 +92,0 @@ |
Sorry, the diff of this file is not supported yet
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
3960200
70332