Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function applyJsonPath(object, path = '$') {
if (typeof object === 'object' && object !== null) {
return jp.value(object, path) || {};
}
return object;
}
setValue: function (path, value) {
jp.value(this.jsonObj, path, value);
},
public set(what: string, value: any) {
jsonpath.value(this.states, `$.${what}`, value);
}
public getComputed(what: string): any {
const fn = jsonpath.value(this.computed, `$.${what}`);
if (typeof fn !== 'function') {
return undefined;
}
return fn(this);
}
protected getNameFromJsonOrganization(jsonOrganization: any): string {
return jsonpath.value(jsonOrganization, '$.organisationName[0].CharacterString[0]._');
}
return lodash.groupBy(responsibleParties, party =>
jsonpath.value(
party,
'$.role[*].CI_RoleCode[*]["$"].codeListValue.value'
)
);
private getRawDatasetId(jsonDataset: any): string {
const urnIdentifier = jsonpath.value(
jsonDataset.json,
"$..MD_Identifier[?(@.codeSpace[0].CharacterString[0]._=='urn:uuid')].code.._"
);
const fileIdentifier = jsonpath.value(
jsonDataset.json,
"$.fileIdentifier[*].CharacterString[*]._"
);
return fileIdentifier || urnIdentifier;
}
protected getNameFromJsonDataset(jsonDataset: any): string {
const dataIdentification = jsonpath.query(jsonDataset.json, '$.identificationInfo[*].MD_DataIdentification[*].dataIdentification[*]');
const serviceIdentification = jsonpath.query(jsonDataset.json, '$.identificationInfo[*].SV_ServiceIdentification[*].serviceIdentification[*]');
const identification = dataIdentification || serviceIdentification || {};
const title = jsonpath.value(identification, '$.citation[*].CI_Citation[*].title[*].CharacterString[*]._') || this.getIdFromJsonDataset(jsonDataset);
return title;
}