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

fetchmap

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetchmap - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "fetchmap",
"version": "0.0.1",
"version": "0.0.2",
"description": "Non-throwing fetch wrapper",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -6,7 +6,7 @@ # fetchmap

[![publish](https://github.com/iyegoroff/fetchmap/workflows/publish/badge.svg)](https://github.com/iyegoroff/fetchmap/actions/workflows/publish.yml)
[![codecov](https://codecov.io/gh/iyegoroff/fetchmap/branch/master/graph/badge.svg?token=8Bgu5fREzH)](https://codecov.io/gh/iyegoroff/fetchmap)
[![codecov](https://codecov.io/gh/iyegoroff/fetchmap/branch/main/graph/badge.svg?token=YC314L3ZF7)](https://codecov.io/gh/iyegoroff/fetchmap)
[![Type Coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fiyegoroff%2Fts-railway%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/fetchmap)
![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/fetchmap?t=1)
[![Bundlephobia](https://img.shields.io/bundlephobia/minzip/fetchmap?label=min+gzip)](https://bundlephobia.com/package/fetchmap)
[![npm](https://img.shields.io/npm/l/fetchmap.svg?t=1495378566925)](https://www.npmjs.com/package/fetchmap)
[![npm](https://img.shields.io/npm/l/fetchmap.svg?t=1495378566926)](https://www.npmjs.com/package/fetchmap)

@@ -25,7 +25,7 @@ <!-- [![Bundlephobia](https://badgen.net/bundlephobia/minzip/fetchmap?label=min+gzip)](https://bundlephobia.com/package/fetchmap) -->

This is a simple wrapper for standard `fetch` function that catches all possible exceptions and returns a 'success or failure' wrapped value. By default this value is just `Response`, but `mapSuccess` and `mapFailure` options can be used to transform the received `Response`. If `response.ok` is `true` response will be transformed by `mapSuccess`, otherwise - by `mapFailure`.
This is a simple wrapper for standard `fetch` function that takes extended `RequestInit` and optional third-party `fetch` funcition, catches all possible exceptions and returns a 'success or failure' wrapped value. By default this value is just `Response`, but `mapSuccess` and `mapFailure` options can be used to transform the received `Response`. If `response.ok` is `true` response will be transformed by `mapSuccess`, otherwise - by `mapFailure`. Possible errors are divided into `clientError`, `mapError` and `serverError`.
## Usage
See [test](/test)
See [test](/test) or [playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgMwKYwMYAsQEMxwC+KUEIcA5GpjvhQFD0YQB2AzvAFYCuHASqjaR2qOAF4U6bHjAAKJNygAbAFyUsMGGBUB6HUogZcSrBA4qArAAYrFikQA0kmgEpGzdlzasAytwwYgmziztL48nCKquqa2noGRiZmMJY2dk4yfgFBahSc3iz2hG5MrBxwAEYGFVmBbGwAgiwAJgAqqAAeMABiuMBKiqIS1GFyCsq5Glq6+obGpubWthQZ+LU5lFUQFStwMr39g7kwnTBFJR7lyNwsGDDAvv51wcNStGOREzHT8XNJi2ldpknhtZFA1AIhGVUC5xAA+OBQAB0HFwMF4RAuZXg204qDuAFl8C9Qu95PQ4JTPtEKFM4rNEgsUkt0hSqcDsvU1EgAEw2XK4KBQXAATwAQtxkGgoLtmqhkLhuEoUpQTl0ig42ZT9n0BlBUNy4AAWKxG46nWXyxXKtRgiGCYRsGHwxFEejFdzYxGoACO3EEMAAkixgDAAPJgGAkkZk8Y0ukzBLzZKpZYZdCmZq5AAKYZ8rV2GH1cpY92MbFywFuAzl53oQA)

@@ -32,0 +32,0 @@ ## Misc

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