@ltht-react/utils
Advanced tools
Comparing version
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.1.10](https://github.com/ltht-epr/ltht-react/compare/@ltht-react/utils@0.1.9...@ltht-react/utils@0.1.10) (2020-08-05) | ||
**Note:** Version bump only for package @ltht-react/utils | ||
## [0.1.9](https://github.com/ltht-epr/ltht-react/compare/@ltht-react/utils@0.1.8...@ltht-react/utils@0.1.9) (2020-08-05) | ||
@@ -8,0 +16,0 @@ |
@@ -76,3 +76,3 @@ "use strict"; | ||
var formatPatientName = function (patient) { | ||
var _a, _b, _c, _d, _e, _f, _g, _h; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; | ||
var activeName = (_b = (_a = patient) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.find(function (x) { var _a, _b, _c, _d; return (!((_a = x) === null || _a === void 0 ? void 0 : _a.period) || !((_c = (_b = x) === null || _b === void 0 ? void 0 : _b.period) === null || _c === void 0 ? void 0 : _c.end)) && ((_d = x) === null || _d === void 0 ? void 0 : _d.use) === types_1.HumanNameUseCode.Official; }); | ||
@@ -82,6 +82,9 @@ if (!activeName) { | ||
} | ||
if (!activeName) { | ||
activeName = (_f = (_e = patient) === null || _e === void 0 ? void 0 : _e.name) === null || _f === void 0 ? void 0 : _f.find(function (x) { var _a, _b, _c, _d; return (!((_a = x) === null || _a === void 0 ? void 0 : _a.period) || !((_c = (_b = x) === null || _b === void 0 ? void 0 : _b.period) === null || _c === void 0 ? void 0 : _c.end)) && !((_d = x) === null || _d === void 0 ? void 0 : _d.use); }); | ||
} | ||
var patientName; | ||
var family = (_e = activeName) === null || _e === void 0 ? void 0 : _e.family; | ||
var title = ((_f = activeName) === null || _f === void 0 ? void 0 : _f.prefix) && activeName.prefix.length > 0 ? activeName.prefix[0] : ''; | ||
var given = (_h = (_g = activeName) === null || _g === void 0 ? void 0 : _g.given) === null || _h === void 0 ? void 0 : _h.join(' '); | ||
var family = (_g = activeName) === null || _g === void 0 ? void 0 : _g.family; | ||
var title = ((_h = activeName) === null || _h === void 0 ? void 0 : _h.prefix) && activeName.prefix.length > 0 ? activeName.prefix[0] : ''; | ||
var given = (_k = (_j = activeName) === null || _j === void 0 ? void 0 : _j.given) === null || _k === void 0 ? void 0 : _k.join(' '); | ||
if (!given) { | ||
@@ -88,0 +91,0 @@ patientName = family ? family.toUpperCase() : ''; |
@@ -332,12 +332,10 @@ "use strict"; | ||
}); | ||
it('returns empty string when patient has no active official/usual name', function () { | ||
patient.name.push({ | ||
use: types_1.HumanNameUseCode.Maiden, | ||
family: 'test', | ||
}); | ||
expect(patient_1.formatPatientName(patient)).toEqual(''); | ||
it('returns formatted string when patient has an active name but use not specified', function () { | ||
patient.name.push({ family: 'test', period: null, use: null }); | ||
expect(patient_1.formatPatientName(patient)).toEqual('TEST'); | ||
}); | ||
it('returns formatted name when patient has active official & usual name', function () { | ||
it('returns formatted name when patient has active official & usual 7 unspecified use name', function () { | ||
patient.name.push({ use: types_1.HumanNameUseCode.Usual, family: 'test-usual' }); | ||
patient.name.push({ use: types_1.HumanNameUseCode.Official, family: 'test-official' }); | ||
patient.name.push({ use: types_1.HumanNameUseCode.Official, family: 'test' }); | ||
expect(patient_1.formatPatientName(patient)).toEqual('TEST-OFFICIAL'); | ||
@@ -344,0 +342,0 @@ }); |
{ | ||
"name": "@ltht-react/utils", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "> TODO: description", | ||
@@ -25,5 +25,5 @@ "author": "Jonny Smith <jonny.asmith@gmail.com>", | ||
"dependencies": { | ||
"@ltht-react/types": "^0.0.16" | ||
"@ltht-react/types": "^0.0.17" | ||
}, | ||
"gitHead": "1c98968107317b820368e426aafb73afb2f0bedf" | ||
"gitHead": "ffc6baeeb9c5672553d28eb1edab0e3b20c436ac" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
91606
1.16%1118
0.18%+ Added
- Removed
Updated