ts/utils/whatwg-fetch.js
File whatwg-fetch.js
has 454 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
// this file is a copy of https://github.com/github/fetch/tree/v2.0.4
// the lines marked with PATCH has been changed to make this
// work with react-native
var self = global; // PATCH
Function Body
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
Open
function Body() {
this.bodyUsed = false;
this._initBody = function(body) {
this._bodyInit = body;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Body
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Body() {
this.bodyUsed = false;
this._initBody = function(body) {
this._bodyInit = body;
Function fetch
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function fetch(input, init) {
return new Promise(function(resolve, reject) {
var request = new Request(input, init);
if (request.signal && request.signal.aborted) {
Function _initBody
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this._initBody = function(body) {
this._bodyInit = body;
if (!body) {
this._bodyText = "";
} else if (typeof body === "string") {
Function Request
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
export function Request(input, options) {
options = options || {};
var body = options.body;
if (input instanceof Request) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function Request
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function Request(input, options) {
options = options || {};
var body = options.body;
if (input instanceof Request) {