react-native-gigya-sdk
Version:
SAP CDC/Gigya SDK for your React Native applications
21 lines • 689 B
JavaScript
export default function (params) {
return JSON.stringify(params, (key, value) =>
/**
* NOTE: Stringifies params from:
*
* { profile: { firstName: 'Test', lastName: 'LastName' }, lang: 'en' }
*
* to:
*
* {"profile":"{\"firstName\":\"Test\",\"lastName\":\"LastName\"}","lang":"en"}
*
* instead of:
*
* {"profile":{"firstName":"Test","lastName":"LastName"},"lang":"en"}
*
* tldr: making sure that, once the whole params argument has been parsed on the native side,
* nested objects will come out as JSON strings and not objects.
*/
key && typeof value === 'object' ? JSON.stringify(value) : value);
}
//# sourceMappingURL=formatParams.js.map