Allows the use of a timeout on promise based functions like Fetch.
npm install @andycasen/withtimeoutAdds a timeout for promise based functions like the fetch API.
$ npm install @andycasen/withtimeout --save
``javascript
const fetch = require('node-fetch')
const withTimeout = require('@andycasen/withtimeout')
const myFetchUrl = 'https://myfetchurl.com'
const myTimeout = 3500 // Timeout in ms
withTimeout(fetch(myFetchUrl), myTimeout)
.then(data => data.json())
.then(data => {
// Do something with your data
})
``