@@ -5,10 +5,10 @@ import {
5
5
hasOwn ,
6
6
isPlainObject ,
7
7
isString ,
8
+ deepCopy ,
8
9
warn
9
10
} from '@intlify/shared'
10
11
import { Text , createVNode } from 'vue'
11
- import { I18nErrorCodes , createI18nError } from './errors'
12
12
import { I18nWarnCodes , getWarnMessage } from './warnings'
13
13
14
14
import type { Locale , MessageResolver } from '@intlify/core-base'
@@ -148,29 +148,6 @@ export function getLocaleMessages<Messages = {}>(
148
148
return ret as { [ K in keyof Messages ] : Messages [ K ] }
149
149
}
150
150
151
- const isNotObjectOrIsArray = ( val : unknown ) => ! isObject ( val ) || isArray ( val )
152
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
153
- export function deepCopy ( src : any , des : any ) : void {
154
- // src and des should both be objects, and non of then can be a array
155
- if ( isNotObjectOrIsArray ( src ) || isNotObjectOrIsArray ( des ) ) {
156
- throw createI18nError ( I18nErrorCodes . INVALID_VALUE )
157
- }
158
-
159
- for ( const key in src ) {
160
- if ( hasOwn ( src , key ) ) {
161
- if ( isNotObjectOrIsArray ( src [ key ] ) || isNotObjectOrIsArray ( des [ key ] ) ) {
162
- // replace with src[key] when:
163
- // src[key] or des[key] is not a object, or
164
- // src[key] or des[key] is a array
165
- des [ key ] = src [ key ]
166
- } else {
167
- // src[key] and des[key] are both object, merge them
168
- deepCopy ( src [ key ] , des [ key ] )
169
- }
170
- }
171
- }
172
- }
173
-
174
151
// eslint-disable-next-line @typescript-eslint/no-explicit-any
175
152
export function getComponentOptions ( instance : ComponentInternalInstance ) : any {
176
153
return ! __BRIDGE__ ? instance . type : instance . proxy ! . $options
0 commit comments