Skip to content

Function: messageArguments() ​

messageArguments(parts): Map<string, string>

List the arguments a parsed message uses, nested choices included, with the type of their first use: argument, number, date, time, plural, selectordinal or select.

Parameters ​

parts ​

MessagePart[]

The parts of the message, from parseMessage.

Returns ​

Map<string, string>

The argument types by argument name, in their order in the message.

Example ​

typescript
import {messageArguments, parseMessage} from 'lakutata/com/i18n'

const args: Map<string, string> = messageArguments(parseMessage('{count, plural, other {# orders}} for {customer}'))
console.log([...args]) //[['count', 'plural'], ['customer', 'argument']]

Released under the MIT License.