Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@teleology/fp

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teleology/fp - npm Package Compare versions

Comparing version 1.0.13 to 1.0.14

lib/poll.js

12

lib/index.js

@@ -185,2 +185,14 @@ "use strict";

});
});
var _poll = require("./poll");
Object.keys(_poll).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _poll[key];
}
});
});

9

lib/timeout.js

@@ -6,7 +6,12 @@ "use strict";

});
exports.timeout = exports.sleep = void 0;
exports.timeout = exports.race = exports.sleep = void 0;
const sleep = (millis, ...params) => new Promise(resolve => setTimeout(resolve, millis, ...params));
const sleep = (millis, ...params) => new Promise(resolve => setTimeout(resolve, millis, ...params)); // Create an alias for Promise.race
exports.sleep = sleep;
const {
race
} = Promise;
exports.race = race;

@@ -13,0 +18,0 @@ const timeout = (fn, millis = 500) => (...args) => Promise.race([sleep(millis, 'timeout'), fn(...args)]).then(result => {

{
"name": "@teleology/fp",
"version": "1.0.13",
"version": "1.0.14",
"description": "A small collection of functional programming utils",

@@ -5,0 +5,0 @@ "repository": "git@github.com:icarus-sullivan/teleology-fp.git",

@@ -255,2 +255,30 @@ # @teleology/fp

## poll
A wrapper around a functon to long-poll at pre-defined intervals. Can be used with defaults or a custom rolloff function.
```javascript
const { poll } = require('@teleology/fp');
const fn = async () => console.log('hello');
const cancel = poll(fn); // calls fn every 200ms
const cancel2 = poll(fn, 1000); // calls fn every 1000ms
const linear = async (i) => new Promise((res) => setTimeout(res, i * 1000));
const cancel3 = poll(fn, linear); // rolls off in a lineaer fashion
```
## noop
A function that does nothing.
```javascript
const { noop } = require('@teleology/fp');
// I do nothing
noop();
```
----

@@ -260,2 +288,5 @@

**1.0.14**
- Added `noop` function
**1.0.10**

@@ -262,0 +293,0 @@ - Adding `timeout` function

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc