Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const guest = 'Bob';
const selectResult = select({
value: gender,
female: plural({
value: numOfGuests,
offset: 1,
0: `${host} does not give a party.`,
1: `${host} invites ${guest} to her party.`,
2: `${host} invites ${guest} and one other person to her party.`,
other: `${host} invites ${guest} and # other people to her party.`
}),
male: 'male',
other: 'other'
});
const selectIdResult = select('selectId', {
value: gender,
female: 'female',
male: 'male',
other: 'other'
});
const formattedDate: MessageDescriptor = date(new Date(), { timeZone: 'UTC' });
const formattedNumber: MessageDescriptor = number(1234.56, { style: 'currency', currency: 'EUR' });
// JSX
const App = () => {
const name = 'Ken';
const numBooks = 58;
const gender = 'male';
const price = 21.35;
const lastLogin = new Date();
other: '#th book'
});
const selectOrdinalIdResult: MessageDescriptor = selectOrdinal('selectOrdinalId', {
value: count,
0: 'Zeroth book',
one: '#st book',
two: '#nd book',
few: '#rd book',
other: '#th book'
});
const gender = 'female';
const numOfGuests = 2;
const host = 'Amy';
const guest = 'Bob';
const selectResult = select({
value: gender,
female: plural({
value: numOfGuests,
offset: 1,
0: `${host} does not give a party.`,
1: `${host} invites ${guest} to her party.`,
2: `${host} invites ${guest} and one other person to her party.`,
other: `${host} invites ${guest} and # other people to her party.`
}),
male: 'male',
other: 'other'
});
const selectIdResult = select('selectId', {
value: gender,
female: 'female',