@arianee/utils
TypeScript icon, indicating that this package has built-in type declarations

1.84.0 • Public • Published

@arianee/utils

This library contains various utilities that are used across the Arianee projects.

cachedFetchLike

A wrapper for fetch like functions that caches the response for well-known arianee urls for a given time (default 1 hour, can be overridden by setting the options.timeToLive property, the cache map can also be passed with options.cache).

Usage:

// simplest usage
cachedFetchLike(fetch);

// can be composed with other fetch wrappers
cachedFetchLike(retryFetchLike(defaultFetchLike));

retryFetchLike

A wrapper for fetch that retry the request on failure.

Usage:

// simplest usage
retryFetchLike(fetch);

// can be composed with other fetch wrappers, retries can be passed as a second optional argument
retryFetchLike(defaultFetchLike, 2);

defaultFetchLike

A fetch like function that works in node and in the browser by selecting the appropriate implementation based on environment (node-fetch or DOM fetch).

Usage:

defaultFetchLike('https://google.com');

Readme

Keywords

none

Package Sidebar

Install

npm i @arianee/utils

Weekly Downloads

52

Version

1.84.0

License

none

Unpacked Size

39.6 kB

Total Files

38

Last publish

Collaborators

  • benjamin.darthout
  • 6ssou
  • 0xwhiteleaf.eth
  • max.teiger
  • gnarco
  • stefdelecjs
  • mvaullerin
  • arianeetech