mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 23:29:35 +02:00
14 lines
354 B
JavaScript
14 lines
354 B
JavaScript
|
'use strict'
|
||
|
|
||
|
const throttle = require('p-throttle')
|
||
|
|
||
|
const request = require('./lib/request')
|
||
|
const createClient = require('.')
|
||
|
|
||
|
const createThrottledClient = (profile, limit = 5, interval = 1000) => {
|
||
|
const throttledRequest = throttle(request, limit, interval)
|
||
|
return createClient(profile, throttledRequest)
|
||
|
}
|
||
|
|
||
|
module.exports = createThrottledClient
|