UNPKG

fume-fhir-converter

Version:

FHIR-Utilized Mapping Engine - Community

22 lines 1.07 kB
"use strict"; /** * © Copyright Outburn Ltd. 2022-2024 All Rights Reserved * Project name: FUME-COMMUNITY */ Object.defineProperty(exports, "__esModule", { value: true }); exports.isTypeNameValid = void 0; // makes sure the "InstanceOf" decleration contains a (fixed) potential FHIR type and not an expression // eslint-disable-next-line @typescript-eslint/quotes, no-useless-escape const isTypeNameValid = (typeName) => { const regexWhitespace = /\s/; const regexUrlOrUrn = /^(http(|s):\/\/|urn:(uuid|oid):).+[^\\s]/; const regexDomain = /[A-Za-z0-9\\-\\.]{1,64}/; const regexAlphaNumeric = /[A-Za-z]([A-Za-z0-9_]){0,254}/; const containsWhitespace = regexWhitespace.test(typeName); const isMatchUrlOrUrn = regexUrlOrUrn.test(typeName); const isMatchDomain = regexDomain.test(typeName); const isMatchAlphaNumeric = regexAlphaNumeric.test(typeName); return !containsWhitespace && (isMatchUrlOrUrn || isMatchDomain || isMatchAlphaNumeric); }; exports.isTypeNameValid = isTypeNameValid; //# sourceMappingURL=isTypeNameValid.js.map