3.1.2 • Published 6 years ago

lazy-axios v3.1.2

Weekly downloads
52
License
ISC
Repository
github
Last release
6 years ago

lazy-axios

Creates bunch of axios-throttled instances

Parameters

Examples

const LazyAxios = require('lazy-axios');;
const paths = {
 from_string: {
  query: 'https://yahoo.com/',
 },
 from_object: {
  query: { url: 'https://google.com/' },
 },
 expand1: {
  query: 'https://{host}/{path}',
 },
 expand2: {
  query: 'https://[[host]]/[[path]]',
 },
 expand3: {
  query: 'https://[[host]]/[[path]]',
  placemarks: ['[[', ']]'],
 },
 till_3000: {
  query: 'query: 'https://yahoo.com/',
 }
};

const lazy_axios = new LazyAxios(paths);
// query url
const additionalParams = {params: {q: 'cats'}}
await lazy_axios.from_string.request(additionalParams);

// query as object
await lazy_axios['from_object'].request({params: {q: 'dogs'}});

// Using placeholders with default placemarks
await lazy_axios.expand1({host: 'mail.google.com', path: 'mail'}).request();

// Using placeholders and custom placemarks
await lazy_axios.expand2({host: 'mail.google.com', path: 'mail'}, ['[[', ']]']).request()

// Using placeholders and preseted custom placemarks
await lazy_axios.expand3({host: 'mail.google.com', path: 'mail'}).request()

// Block requests until year 3000
lazy_axios.till_3000.stay = () => Date.now() > (new Date('3000/01/01')).getTime()
await lazy_axios.till_3000({params: {q: 'jam'}}).request()
3.1.2

6 years ago

3.1.1

6 years ago

3.0.4

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.5

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.2.3

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago