diff options
author | Jeffrey Burdges <burdges@gnunet.org> | 2017-08-29 13:41:58 +0200 |
---|---|---|
committer | Jeffrey Burdges <burdges@gnunet.org> | 2017-08-29 13:41:58 +0200 |
commit | 541256ca99875b6007cf6338f7593c8397053514 (patch) | |
tree | 662ca2ee4d1846401bdc826895ad7a8390d54f9a /node_modules/axios/lib/axios.js | |
parent | 33edef30acda54fc23ec1238d8de13c07a0c87a8 (diff) | |
parent | 52ebba90d6625f78105b94fb4f528bca829cb18f (diff) |
Merge branch 'master' of ssh://taler.net/wallet-webex
Diffstat (limited to 'node_modules/axios/lib/axios.js')
-rw-r--r-- | node_modules/axios/lib/axios.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/node_modules/axios/lib/axios.js b/node_modules/axios/lib/axios.js new file mode 100644 index 000000000..ed1f51941 --- /dev/null +++ b/node_modules/axios/lib/axios.js @@ -0,0 +1,52 @@ +'use strict'; + +var utils = require('./utils'); +var bind = require('./helpers/bind'); +var Axios = require('./core/Axios'); +var defaults = require('./defaults'); + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * @return {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + var context = new Axios(defaultConfig); + var instance = bind(Axios.prototype.request, context); + + // Copy axios.prototype to instance + utils.extend(instance, Axios.prototype, context); + + // Copy context to instance + utils.extend(instance, context); + + return instance; +} + +// Create the default instance to be exported +var axios = createInstance(defaults); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios; + +// Factory for creating new instances +axios.create = function create(instanceConfig) { + return createInstance(utils.merge(defaults, instanceConfig)); +}; + +// Expose Cancel & CancelToken +axios.Cancel = require('./cancel/Cancel'); +axios.CancelToken = require('./cancel/CancelToken'); +axios.isCancel = require('./cancel/isCancel'); + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; +axios.spread = require('./helpers/spread'); + +module.exports = axios; + +// Allow use of default import syntax in TypeScript +module.exports.default = axios; |