fetch-plus
Advanced tools
Comparing version 3.9.0 to 3.9.2
@@ -76,7 +76,7 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
function _trimSlashes(string) { | ||
var _trimSlashes = function _trimSlashes(string) { | ||
return string.toString().replace(/(^\/+|\/+$)/g, ""); | ||
} | ||
}; | ||
function createClient(url) { | ||
var createClient = function createClient(url) { | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
@@ -107,3 +107,3 @@ var middlewares = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2]; | ||
return endpoint; | ||
} | ||
}; | ||
@@ -134,3 +134,3 @@ var middlewareId = 23000; | ||
function _callFetch(endpoint) { | ||
var _callFetch = function _callFetch(endpoint) { | ||
var path = arguments.length <= 1 || arguments[1] === undefined ? "" : arguments[1]; | ||
@@ -249,5 +249,5 @@ var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
}); | ||
} | ||
}; | ||
function _expectEven(array) { | ||
var _expectEven = function _expectEven(array) { | ||
array = (0, _compute.compute)(array); | ||
@@ -260,5 +260,5 @@ | ||
return array; | ||
} | ||
}; | ||
function _expectOdd(array) { | ||
var _expectOdd = function _expectOdd(array) { | ||
array = (0, _compute.compute)(array); | ||
@@ -271,3 +271,3 @@ | ||
return array; | ||
} | ||
}; | ||
@@ -370,3 +370,3 @@ function request(_endpoint, path) { | ||
function _dropInFetch(url) { | ||
var _dropInFetch = function _dropInFetch(url) { | ||
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
@@ -380,3 +380,3 @@ var middlewares = arguments.length <= 2 || arguments[2] === undefined ? [] : arguments[2]; | ||
}, "", {}, middlewares); | ||
} | ||
}; | ||
@@ -423,19 +423,30 @@ module.exports = { | ||
function compute(value) { | ||
var _isScalar = function _isScalar(value) { | ||
return value === undefined || value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean"; | ||
}; | ||
var compute = function compute(value) { | ||
return typeof value === "function" ? value() : value; | ||
} | ||
}; | ||
function computeObject(object) { | ||
var mapped = {}; | ||
var computeObject = function computeObject(object) { | ||
object = compute(object); | ||
if (_isScalar(object)) { | ||
return object; | ||
} | ||
var mapped = {}; | ||
Object.keys(object).forEach(function (key) { | ||
var value = object[key]; | ||
if (value === null) { | ||
mapped[key] = null; | ||
if (_isScalar(value)) { | ||
mapped[key] = value; | ||
} else if (typeof FormData === "function" && value instanceof FormData) { | ||
mapped[key] = value; | ||
} else if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === "object") { | ||
mapped[key] = computeObject(value); | ||
} else { | ||
mapped[key] = (typeof value === "undefined" ? "undefined" : _typeof(value)) === "object" ? computeObject(value) : compute(value); | ||
mapped[key] = compute(value); | ||
} | ||
@@ -445,3 +456,3 @@ }); | ||
return mapped; | ||
} | ||
}; | ||
@@ -448,0 +459,0 @@ module.exports = { |
{ | ||
"name": "fetch-plus", | ||
"description": "A convenient Fetch API library with first-class middleware support", | ||
"version": "3.9.0", | ||
"version": "3.9.2", | ||
"license": "BSD-3-Clause", | ||
@@ -6,0 +6,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17426
415