UNPKG

@dasch-swiss/dsp-js

Version:

JavaScript library that handles API requests to Knora

35 lines 1.32 kB
import { TypeGuard } from "../resources/type-guard"; /** * @category Internal */ var ClassAndPropertyDefinitions = /** @class */ (function () { function ClassAndPropertyDefinitions() { } /** * Given a map of entity Iris to entity definitions, * returns an array of entity definitions. * * @param entityDefs Entity definitions to be returned as an array. */ ClassAndPropertyDefinitions.prototype.getAllEntityDefinitionsAsArray = function (entityDefs) { var entityIndexes = Object.keys(entityDefs); return entityIndexes.map(function (entityIndex) { return entityDefs[entityIndex]; }); }; /** * Given an array of entity definitions, * returns only the entity definitions matching the given type. * * @param entityDefs The entity definitions to be filtered. * @param type The type of entity definitions to be returned. */ ClassAndPropertyDefinitions.prototype.getEntityDefinitionsByTypeAsArray = function (entityDefs, type) { return entityDefs.filter(function (entityDef) { return TypeGuard.typeGuard(entityDef, type); }); }; return ClassAndPropertyDefinitions; }()); export { ClassAndPropertyDefinitions }; //# sourceMappingURL=ClassAndPropertyDefinitions.js.map