UNPKG

@wordpress/editor

Version:
8 lines (7 loc) 929 B
{ "version": 3, "sources": ["../../src/utils/get-collaborator-display-name.ts"], "sourcesContent": ["import type { CollaboratorInfo } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Return a collaborator name localized for the current viewer.\n *\n * Fallback names are stored untranslated in shared awareness state so peers\n * with different profile languages do not receive another user's translation.\n *\n * @param collaboratorInfo Collaborator information from awareness state.\n * @return The collaborator name to display.\n */\nexport function getCollaboratorDisplayName(\n\tcollaboratorInfo: Pick< CollaboratorInfo, 'id' | 'name' >\n): string {\n\treturn null === collaboratorInfo.id\n\t\t? __( 'Anonymous User' )\n\t\t: collaboratorInfo.name;\n}\n"], "mappings": ";AACA,SAAS,UAAU;AAWZ,SAAS,2BACf,kBACS;AACT,SAAO,SAAS,iBAAiB,KAC9B,GAAI,gBAAiB,IACrB,iBAAiB;AACrB;", "names": [] }