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 = {
56
56
57
57
const DEFAULT_MODIFIER = ( str : unknown ) : unknown => str
58
58
const DEFAULT_MESSAGE = ( ctx : MessageContext ) : unknown => '' // eslint-disable-line
59
- const DEFAULT_TYPE = 'text'
59
+ export const DEFAULT_MESSAGE_DATA_TYPE = 'text'
60
60
const DEFAULT_NORMALIZE = ( values : unknown [ ] ) : unknown =>
61
61
values . length === 0 ? values [ 0 ] : values . join ( '' )
62
62
const DEFAULT_INTERPOLATE = toDisplayString
@@ -152,7 +152,7 @@ export function createMessageContext<N = {}>(
152
152
const type =
153
153
isPlainObject ( options . processor ) && isString ( options . processor . type )
154
154
? options . processor . type
155
- : DEFAULT_TYPE
155
+ : DEFAULT_MESSAGE_DATA_TYPE
156
156
157
157
const normalize =
158
158
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'
2
2
import {
3
3
LinkedModifiers ,
4
4
PluralizationRules ,
5
- MessageProcessor
5
+ MessageProcessor ,
6
+ DEFAULT_MESSAGE_DATA_TYPE
6
7
} from '../message/context'
7
8
import { Path } from '../path'
8
9
import {
@@ -89,12 +90,12 @@ export type RuntimeContext = {
89
90
90
91
const DEFAULT_LINKDED_MODIFIERS : LinkedModifiers = {
91
92
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 ,
93
94
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 ,
95
96
// prettier-ignore
96
97
capitalize : ( val : unknown , type : string ) : unknown =>
97
- type === 'text'
98
+ type === DEFAULT_MESSAGE_DATA_TYPE
98
99
? `${ ( val as string ) . charAt ( 0 ) . toLocaleUpperCase ( ) } ${ ( val as string ) . substr ( 1 ) } `
99
100
: val
100
101
}
You can’t perform that action at this time.
0 commit comments