Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fitch

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fitch - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

.nyc_output/3e5e342a2001cc760b45d5806abdd859.json

2

package.json
{
"name": "fitch",
"version": "0.6.0",
"version": "0.7.0",
"description": "A lightweight Promise based HTTP client, using Fetch API.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,3 +5,3 @@ ![Fitch.js](https://github.com/raphaelpor/fitch.js/raw/master/assets/fitch-mini.png)

[![npm version](https://badge.fury.io/js/fitch.svg)](https://badge.fury.io/js/fitch)
[![npm version](https://badge.fury.io/js/fitch.svg)](https://www.npmjs.com/package/fitch)
[![Build Status](https://travis-ci.org/raphaelpor/fitch.js.svg?branch=master)](https://travis-ci.org/raphaelpor/fitch.js)

@@ -8,0 +8,0 @@ [![Documentation Status](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](https://github.com/raphaelpor/fitch.js/blob/master/docs/Intro.md)

@@ -33,19 +33,23 @@ require('es6-promise').polyfill();

}
const configObj = config.create(method, req);
const call = fetch(url + paramsEncoded, configObj);
return req.raw ? call : call.then(this.check);
return req.raw ? call : call.then(resp => this.check(resp, req.dataType));
},
check(resp) {
if (resp.ok) {
return resp.json();
check(resp, dataType = 'json') {
const typeList = ['arrayBuffer', 'blob', 'formData', 'json', 'text'];
const included = typeList.indexOf(dataType);
if (resp.ok && included !== -1) {
return resp[dataType]();
}
throw new Error(`${resp.status} - ${resp.statusText}.`);
},
error(err) {
if (err) {
console.log('Error >', err);
}
error(err = '') {
console.log('Error >', err);
},
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc