@@ -2,7 +2,8 @@ import type {
22 ApplyPath ,
33 MainWindow ,
44 PartytownForwardProperty ,
5- PartytownForwardSettingsProperty ,
5+ PartytownForwardPropertySettings ,
6+ PartytownForwardPropertyWithSettings ,
67 RandomId ,
78 StringIndexable ,
89} from './types' ;
@@ -145,16 +146,19 @@ export const isValidUrl = (url: any): boolean => {
145146 }
146147} ;
147148
149+ const defaultPartytownForwardPropertySettings : Required < PartytownForwardPropertySettings > = {
150+ preserveBehavior : false ,
151+ } ;
152+
148153export const resolvePartytownForwardProperty = (
149- property : PartytownForwardProperty
150- ) : PartytownForwardSettingsProperty => {
151- if ( typeof property === 'string' ) {
152- return {
153- property,
154- preserveBehavior : false ,
155- } ;
154+ propertyOrPropertyWithSettings : PartytownForwardProperty
155+ ) : Required < PartytownForwardPropertyWithSettings > => {
156+ if ( typeof propertyOrPropertyWithSettings === 'string' ) {
157+ return [ propertyOrPropertyWithSettings , defaultPartytownForwardPropertySettings ] ;
156158 }
157- return property ;
159+ const [ property , settings = defaultPartytownForwardPropertySettings ] =
160+ propertyOrPropertyWithSettings ;
161+ return [ property , { ...defaultPartytownForwardPropertySettings , ...settings } ] ;
158162} ;
159163
160164type GetOriginalBehaviorReturn = {
0 commit comments