(fns, response)
| 13 | * @returns {*} The resulting transformed data |
| 14 | */ |
| 15 | export default function transformData(fns, response) { |
| 16 | const config = this || defaults; |
| 17 | const context = response || config; |
| 18 | const headers = AxiosHeaders.from(context.headers); |
| 19 | let data = context.data; |
| 20 | |
| 21 | utils.forEach(fns, function transform(fn) { |
| 22 | data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); |
| 23 | }); |
| 24 | |
| 25 | headers.normalize(); |
| 26 | |
| 27 | return data; |
| 28 | } |