Function: getStatusesByValue() ​
getStatusesByValue(
id,entity,field,events):string|null
Defined in: packages/validate-openalex/src/events/getter.ts:547
Get the status of a specific event by its ID, entity, and field. Computes the status based on the number of unique value entries for each status.
The status is determined as follows:
- If there are no events matching the criteria, returns
null. - Otherwise, returns a formatted string showing counts of unique
valueentries for each status:- Accepted count in blue
- Pending count in yellow
- Rejected count in red
Counts are right-aligned with a width of 4 characters, and a dot (·) is used to indicate zero counts.
Parameters ​
id ​
The ORCID of the author.
entity ​
The entity type (e.g., 'author').
field ​
The field name (e.g., 'display_name_alternatives').
events ​
IEvent[]
The list of events to search.
Returns ​
string | null
The status of the event or null if not found.
Examples ​
ts
// returns " 3 · 1" if there are 3 accepted, 0 pending, and 1 rejected unique values
getStatusesByValue('0000-0001-2345-6789', 'author', 'display_name_alternatives', events);ts
// returns null if there are no events matching the criteria
getStatusesByValue('0000-0001-2345-6789', 'author', 'affiliation', []);ts
// returns " · · ·" if there are events but none matching the criteria
getStatusesByValue('0000-0001-2345-6789', 'author', 'affiliation', eventsWithNoMatches);Remarks ​
- Matching uses strict equality for
id,entity, andfield(case-sensitive). - Relies on the
IEventshape to containid,entity,field,status, andvalueproperties.