@teleology/fp
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -161,2 +161,14 @@ "use strict"; | ||
}); | ||
}); | ||
var _timeout = require("./timeout"); | ||
Object.keys(_timeout).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function () { | ||
return _timeout[key]; | ||
} | ||
}); | ||
}); |
{ | ||
"name": "@teleology/fp", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "A small collection of functional programming utils", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:icarus-sullivan/teleology-fp.git", |
@@ -241,2 +241,16 @@ # @teleology/fp | ||
## timeout | ||
Curries a given function, millis and ensures an error is thrown when a timeout occurs. | ||
```javascript | ||
const { timeout } = require('@teleology/fp'); | ||
const timed = timeout( | ||
async () => new Promise((resolve) => setTimeout(resolve, 9000)), // long running task | ||
200, // timeout | ||
); | ||
timed('hello').then(console.log).catch(console.log); | ||
``` | ||
---- | ||
@@ -246,2 +260,5 @@ | ||
**1.0.10** | ||
- Adding `timeout` function | ||
**1.0.9** | ||
@@ -248,0 +265,0 @@ - Adding `retry, settle` functions |
16066
19
300
277