2.0.0 • Published 4 years ago

fetch-json-resource v2.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

Fetch JSON Resource

Code Smells Maintainability Rating Reliability Rating Security Rating SonarCloud Bugs Sonarcloud Status SonarCloud Vulnerabilities Technical Debt

Fetch JSON resource with AbortController and error handling.

  • no dependencies
  • ~600 bytes gzipped

Usage

# Install
npm i fetch-json-resource
import fetchJsonResource from 'fetch-json-resource';

fetchJsonResource('https://jsonplaceholder.typicode.com/todos/1')
  .then((json) => console.log(json))
  .catch((error) => console.log(error));

Options

You can add additional fetch options and/or a custom timeout value.

import fetchJsonResource from 'fetch-json-resource';

// Fetch options
const options = {};

// Abort after 5 seconds
const timeout = 5000;

fetchJsonResource('https://jsonplaceholder.typicode.com/todos/1', options, timeout)
  .then((json) => console.log(json))
  .catch((error) => console.log(error));
2.0.0

4 years ago

1.0.0

4 years ago

0.6.3

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.3

4 years ago

0.5.0

4 years ago

0.5.2

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago