2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00

Changing to file level use strict statement

This commit is contained in:
mzabriskie
2015-03-18 17:21:15 -06:00
parent fc12b933f7
commit 60a82ef424
15 changed files with 31 additions and 45 deletions
+2 -2
View File
@@ -1,7 +1,8 @@
'use strict';
var utils = require('./../utils');
function encode(val) {
'use strict';
return encodeURIComponent(val).
replace(/%40/gi, '@').
replace(/%3A/gi, ':').
@@ -18,7 +19,6 @@ function encode(val) {
* @returns {string} The formatted url
*/
module.exports = function buildUrl(url, params) {
'use strict';
if (!params) {
return url;
}
+2 -3
View File
@@ -1,8 +1,9 @@
'use strict';
var utils = require('./../utils');
module.exports = {
write: function write(name, value, expires, path, domain, secure) {
'use strict';
var cookie = [];
cookie.push(name + '=' + encodeURIComponent(value));
@@ -26,13 +27,11 @@ module.exports = {
},
read: function read(name) {
'use strict';
var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null);
},
remove: function remove(name) {
'use strict';
this.write(name, '', Date.now() - 86400000);
}
};
+2 -3
View File
@@ -1,3 +1,5 @@
'use strict';
/**
* Supply a warning to the developer that a method they are using
* has been deprecated.
@@ -7,9 +9,6 @@
* @param {string} [docs] The documentation URL to get further details
*/
module.exports = function deprecatedMethod(method, instead, docs) {
/*eslint-env node*/
'use strict';
try {
console.warn(
'DEPRECATED method `' + method + '`.' +
+2 -1
View File
@@ -1,3 +1,5 @@
'use strict';
var utils = require('./../utils');
/**
@@ -14,7 +16,6 @@ var utils = require('./../utils');
* @returns {Object} Headers parsed into an object
*/
module.exports = function parseHeaders(headers) {
'use strict';
var parsed = {}, key, val, i;
if (!headers) { return parsed; }
+2 -1
View File
@@ -1,3 +1,5 @@
'use strict';
/**
* Syntactic sugar for invoking a function and expanding an array for arguments.
*
@@ -19,7 +21,6 @@
* @returns {Function}
*/
module.exports = function spread(callback) {
'use strict';
return function (arr) {
callback.apply(null, arr);
};
+2 -1
View File
@@ -1,3 +1,5 @@
'use strict';
var utils = require('./../utils');
/**
@@ -9,7 +11,6 @@ var utils = require('./../utils');
* @returns {*} The resulting transformed data
*/
module.exports = function transformData(data, headers, fns) {
'use strict';
utils.forEach(fns, function (fn) {
data = fn(data, headers);
});
+2 -2
View File
@@ -1,3 +1,5 @@
'use strict';
var utils = require('./../utils');
var msie = /(msie|trident)/i.test(navigator.userAgent);
var urlParsingNode = document.createElement('a');
@@ -10,7 +12,6 @@ var originUrl;
* @returns {Object}
*/
function urlResolve(url) {
'use strict';
var href = url;
if (msie) {
@@ -45,7 +46,6 @@ originUrl = urlResolve(window.location.href);
* @returns {boolean} True if URL shares the same origin, otherwise false
*/
module.exports = function urlIsSameOrigin(requestUrl) {
'use strict';
var parsed = (utils.isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
return (parsed.protocol === originUrl.protocol &&
parsed.host === originUrl.host);