run-first-only 1.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  [![NPM version][npm-image]][npm-url]
2
- [![Build Status][travis-image]][travis-url]
3
- [![Dependency Status][gemnasium-image]][gemnasium-url]
2
+ [![Build Status][build-image]][build-url]
3
+ [![Dependency Status][deps-image]][deps-url]
4
4
 
5
5
  # run-first-only
6
6
 
@@ -44,11 +44,11 @@ MIT © [Damian Krzeminski](https://furkot.com)
44
44
 
45
45
  [async.memoize]: http://caolan.github.io/async/docs.html#memoize
46
46
 
47
- [npm-image]: https://img.shields.io/npm/v/run-first-only.svg
47
+ [npm-image]: https://img.shields.io/npm/v/run-first-only
48
48
  [npm-url]: https://npmjs.org/package/run-first-only
49
49
 
50
- [travis-url]: https://travis-ci.org/pirxpilot/run-first-only
51
- [travis-image]: https://img.shields.io/travis/pirxpilot/run-first-only.svg
50
+ [build-url]: https://github.com/pirxpilot/run-first-only/actions/workflows/check.yaml
51
+ [build-image]: https://img.shields.io/github/actions/workflow/status/pirxpilot/run-first-only/check.yaml?branch=main
52
52
 
53
- [gemnasium-image]: https://img.shields.io/gemnasium/pirxpilot/run-first-only.svg
54
- [gemnasium-url]: https://gemnasium.com/pirxpilot/run-first-only
53
+ [deps-image]: https://img.shields.io/librariesio/release/npm/run-first-only
54
+ [deps-url]: https://libraries.io/npm/run-first-only
package/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  module.exports = runOnce;
2
2
 
3
3
  function runOnce(asyncFn) {
4
- var queue = [];
5
- var results;
4
+ let queue = [];
5
+ let results;
6
+
7
+ return worker;
6
8
 
7
9
  function worker(next) {
8
10
  if (results) {
@@ -12,13 +14,11 @@ function runOnce(asyncFn) {
12
14
  queue.push(next);
13
15
 
14
16
  if (queue.length === 1) {
15
- asyncFn(function() {
16
- results = arguments;
17
+ asyncFn((...args) => {
18
+ results = args;
17
19
  queue.forEach(worker);
18
20
  queue = undefined;
19
21
  });
20
22
  }
21
23
  }
22
-
23
- return worker;
24
24
  }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "run-first-only",
3
- "version": "1.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Execute only first call of the async function.",
5
5
  "author": {
6
6
  "name": "Damian Krzeminski",
7
7
  "email": "pirxpilot@furkot.om",
8
8
  "url": "https://furkot.com"
9
9
  },
10
- "repository": "pirxpilot/run-first-only",
10
+ "repository": "github:pirxpilot/run-first-only",
11
11
  "license": "MIT",
12
12
  "keywords": [
13
13
  "run-first-only",
@@ -15,11 +15,8 @@
15
15
  "once",
16
16
  "memoize"
17
17
  ],
18
- "dependencies": {},
19
18
  "devDependencies": {
20
- "jshint": "^2.9.4",
21
- "mocha": "^3.3.0",
22
- "should": "^11.2.1"
19
+ "@biomejs/biome": "^2.3.14"
23
20
  },
24
21
  "scripts": {
25
22
  "test": "make check"
@@ -27,4 +24,4 @@
27
24
  "files": [
28
25
  "index.js"
29
26
  ]
30
- }
27
+ }
package/History.md DELETED
@@ -1,5 +0,0 @@
1
-
2
- 1.0.0 / 2017-04-27
3
- ==================
4
-
5
- * initial implementation