@sap-cloud-sdk/odata-common
Version:
SAP Cloud SDK for JavaScript common functions of OData client generator and OpenAPI clint generator.
41 lines • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEdmType = isEdmType;
exports.isOrderableEdmType = isOrderableEdmType;
/**
* Check whether a value is an EdmType. This will yield positive results for every string starting with `Edm.`.
* @param val - Value to test.
* @returns Whether the given value is of type {@link EdmTypeShared}
* @internal
*/
function isEdmType(val) {
return typeof val === 'string' && val.startsWith('Edm.');
}
/**
* Convenience function to check whether a given EDM type is of type {@link OrderableEdmType}.
* @param edmType - Literal EDM type string to check.
* @returns Whether the given `edmType` is of type {@link OrderableEdmType}.
*/
function isOrderableEdmType(edmType) {
return [
'Edm.Decimal',
'Edm.Double',
'Edm.Single',
'Edm.Float',
'Edm.Int16',
'Edm.Int32',
'Edm.Int64',
'Edm.SByte',
'Edm.Byte',
'Edm.DateTime',
'Edm.DateTimeOffset',
'Edm.Time',
'Edm.Date',
'Edm.Duration',
'Edm.TimeOfDay',
'Edm.String',
'Edm.Boolean',
'Edm.Guid'
].includes(edmType);
}
//# sourceMappingURL=edm-types.js.map