@hestia-earth/schema-convert 14.0.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/csv-pivot.js +1 -1
- package/json.d.ts +1 -1
- package/json.js +10 -3
- package/package.json +1 -1
package/csv-pivot.js
CHANGED
|
@@ -68,7 +68,7 @@ var termId = function (term) { return term ? term['@id'] || term.id : undefined;
|
|
|
68
68
|
var convertTerm = function (term) { return term ? { methodModel: termId(term) } : {}; };
|
|
69
69
|
var pivotList = function (values) { return values.reduce(function (prev, _a) {
|
|
70
70
|
var _b;
|
|
71
|
-
var
|
|
71
|
+
var _t = _a["@type"], term = _a.term, methodModel = _a.methodModel, value = _a.value;
|
|
72
72
|
var key = termId(term);
|
|
73
73
|
var data = utils_1.reduceUndefinedValues(__assign(__assign({}, convertTerm(methodModel)), { value: convertValue(value) }));
|
|
74
74
|
return __assign(__assign({}, prev), (key && Object.keys(data).length ? (_b = {}, _b[key] = (prev[key] || []).concat([data]), _b) : {}));
|
package/json.d.ts
CHANGED
package/json.js
CHANGED
|
@@ -245,12 +245,19 @@ var validateGeoJSONFormat = function (value) {
|
|
|
245
245
|
};
|
|
246
246
|
/**
|
|
247
247
|
* If the user provided a non-object where an object was expected, assume it was meant to be the `name` property.
|
|
248
|
-
* For
|
|
248
|
+
* For Blank Nodes, we assume it is the `term.name`.
|
|
249
|
+
* For non-Term Nodes, we assume it is the `id`.
|
|
249
250
|
*
|
|
250
251
|
* @param value The value mapped as a Ref
|
|
251
252
|
*/
|
|
252
|
-
var schemaRefValue = function (value,
|
|
253
|
-
return typeof value === 'object'
|
|
253
|
+
var schemaRefValue = function (value, type) {
|
|
254
|
+
return typeof value === 'object'
|
|
255
|
+
? value
|
|
256
|
+
: type === schema_1.SchemaType.Term
|
|
257
|
+
? { name: value }
|
|
258
|
+
: schema_1.isBlankNode({ type: type })
|
|
259
|
+
? { term: { name: value } }
|
|
260
|
+
: { id: value };
|
|
254
261
|
};
|
|
255
262
|
exports.cleanStringValue = function (value) { return (value.match(/^[\d]+\.[\d]+\.[\d]+$/) === null ? value.replace(/\.0$/, '') : value).trim(); };
|
|
256
263
|
var propertyTypeToValue = {
|