The patron.ts file in the shared Sierra client was a bit big and unwieldy, and doing a bunch of things.
I've broken it up, and created a new marc namespace which will contain the MARC-related logic. Right now that means:
the MARC field types
the function getPatronName(varFields: VarField[])
I've added a bunch of tests for getPatronName(), based on the structure of names in the real patron data. This gives us more of a safety net when working on this function, and allowed me to simplify in a couple of places where we're handling scenarios that never occur in practice. I'll highlight these inline.
The next step will be a new function createPatronName(name: Name): VarField, which we can use whenever we want to set somebody's name – but that'll be a separate patch.
This is a no-op refactoring change for https://github.com/wellcomecollection/wellcomecollection.org/issues/8207
The
patron.ts
file in the shared Sierra client was a bit big and unwieldy, and doing a bunch of things.I've broken it up, and created a new
marc
namespace which will contain the MARC-related logic. Right now that means:getPatronName(varFields: VarField[])
I've added a bunch of tests for
getPatronName()
, based on the structure of names in the real patron data. This gives us more of a safety net when working on this function, and allowed me to simplify in a couple of places where we're handling scenarios that never occur in practice. I'll highlight these inline.The next step will be a new function
createPatronName(name: Name): VarField
, which we can use whenever we want to set somebody's name – but that'll be a separate patch.