@react-native-kakao/share
Version:
React Native Kakao Share SDK
24 lines (21 loc) • 745 B
text/typescript
import { Platform } from 'react-native';
import { replaceJsonValuesRecursively } from '@mj-studio/js-util';
export function swapMobileExecutionParamsFieldValueIntoStringInIOS<T extends object>(
template: T,
): T {
if (Platform.OS !== 'ios') {
return template;
}
return replaceJsonValuesRecursively(template, {
replacer: {
androidExecutionParams: (value: Record<string, string>) =>
Object.entries(value)
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
.join('&'),
iosExecutionParams: (value: Record<string, string>) =>
Object.entries(value)
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
.join('&'),
},
});
}