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