Use cases
Change Text Case

Change text case

Heh, thought I'd forget about it? Of course not, you can add a converter function at the instance level and at the called method level as well.

Instance level

import * as changeCase from 'change-case'
 
const options = {
	fetchOptions: {
		baseURL: 'https://someyourapi.com/'
	},
  	caseTransform: (str) => changeCase.snakeCase(str)
}
 
const flyapiInstance = flyapi(options)
 
const allTodos = await flyapiInstance.someEndPoint.exec() // Transformed to https://someyourapi.com/some_end_point

Self level

const allTodos = await flyapiInstance.someEndPoint.exec({
	caseTransform: (str) => changeCase.snakeCase(str) // Transformed to https://someyourapi.com/some_end_point
})