File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ export type MessageContext = {
5656
5757const DEFAULT_MODIFIER = ( str : unknown ) : unknown => str
5858const DEFAULT_MESSAGE = ( ctx : MessageContext ) : unknown => '' // eslint-disable-line
59- const DEFAULT_TYPE = 'text'
59+ export const DEFAULT_MESSAGE_DATA_TYPE = 'text'
6060const DEFAULT_NORMALIZE = ( values : unknown [ ] ) : unknown =>
6161 values . length === 0 ? values [ 0 ] : values . join ( '' )
6262const DEFAULT_INTERPOLATE = toDisplayString
@@ -152,7 +152,7 @@ export function createMessageContext<N = {}>(
152152 const type =
153153 isPlainObject ( options . processor ) && isString ( options . processor . type )
154154 ? options . processor . type
155- : DEFAULT_TYPE
155+ : DEFAULT_MESSAGE_DATA_TYPE
156156
157157 const normalize =
158158 isPlainObject ( options . processor ) && isFunction ( options . processor . normalize )
Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ import { MessageFunction } from '../message/compiler'
22import {
33 LinkedModifiers ,
44 PluralizationRules ,
5- MessageProcessor
5+ MessageProcessor ,
6+ DEFAULT_MESSAGE_DATA_TYPE
67} from '../message/context'
78import { Path } from '../path'
89import {
@@ -89,12 +90,12 @@ export type RuntimeContext = {
8990
9091const DEFAULT_LINKDED_MODIFIERS : LinkedModifiers = {
9192 upper : ( val : unknown , type : string ) : unknown =>
92- type === 'text' ? ( val as string ) . toUpperCase ( ) : val ,
93+ type === DEFAULT_MESSAGE_DATA_TYPE ? ( val as string ) . toUpperCase ( ) : val ,
9394 lower : ( val : unknown , type : string ) : unknown =>
94- type === 'text' ? ( val as string ) . toLowerCase ( ) : val ,
95+ type === DEFAULT_MESSAGE_DATA_TYPE ? ( val as string ) . toLowerCase ( ) : val ,
9596 // prettier-ignore
9697 capitalize : ( val : unknown , type : string ) : unknown =>
97- type === 'text'
98+ type === DEFAULT_MESSAGE_DATA_TYPE
9899 ? `${ ( val as string ) . charAt ( 0 ) . toLocaleUpperCase ( ) } ${ ( val as string ) . substr ( 1 ) } `
99100 : val
100101}
You can’t perform that action at this time.
0 commit comments