Skip to content

Commit d041571

Browse files
committed
update deps, add CI
1 parent b89900e commit d041571

17 files changed

+140
-87
lines changed

.eslintrc.json

-36
This file was deleted.

.github/ISSUE_TEMPLATE/bug-report.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Bug Report
3+
about: New issues are for bug reports only. For everything else, use Discussions.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
### Expected behavior
11+
12+
13+
### Actual behavior
14+
15+
16+
### Steps to reproduce
17+
18+
19+
### Environment
20+
21+
* Version of spex:
22+
* OS type (Linux/Windows/Mac):
23+
* Version of Node.js:

.github/workflows/ci.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
node-version: [14.x, 20.x]
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
25+
- run: npm install
26+
- run: npm run lint
27+
- run: npm run coverage

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Specialized Promise Extensions
1+
SPEX
2+
----
23

3-
[![Build Status](https://travis-ci.org/vitaly-t/spex.svg?branch=master)](https://travis-ci.org/vitaly-t/spex)
4-
[![Coverage Status](https://coveralls.io/repos/vitaly-t/spex/badge.svg?branch=master)](https://coveralls.io/r/vitaly-t/spex?branch=master)
5-
[![Join the chat at https://gitter.im/vitaly-t/spex](https://badges.gitter.im/vitaly-t/spex.svg)](https://gitter.im/vitaly-t/spex?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4+
Specialized Promise Extensions.
5+
6+
[![Build Status](https://github.com/vitaly-t/spex/actions/workflows/ci.yml/badge.svg)](https://github.com/vitaly-t/spex/actions/workflows/ci.yml)
7+
[![Node Version](https://img.shields.io/badge/nodejs-14%20--%2020-green.svg?logo=node.js&style=flat)](https://nodejs.org)
68

79
[batch], [page], [sequence] - promise methods for the following patterns:
810
* [Data Throttling & Load Balancing](http://vitaly-t.github.io/spex/tutorial-throttling.html)

eslint.config.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const js = require("@eslint/js");
2+
const globals = require("globals");
3+
4+
module.exports = [
5+
js.configs.recommended,
6+
{
7+
languageOptions: {
8+
globals: {
9+
...globals.es6,
10+
...globals.node,
11+
...globals.jasmine,
12+
...globals.BigInt,
13+
},
14+
parserOptions: {
15+
ecmaFeatures: { globalReturn: true },
16+
},
17+
sourceType: "commonjs",
18+
ecmaVersion: 2022,
19+
},
20+
rules: {
21+
"no-var": "error",
22+
"prefer-const": "error",
23+
"prefer-arrow-callback": "error",
24+
"no-else-return": "error",
25+
"no-multi-spaces": "error",
26+
"no-whitespace-before-property": "error",
27+
camelcase: "error",
28+
"new-cap": "error",
29+
"no-console": "error",
30+
"comma-dangle": "error",
31+
"no-shadow": "error",
32+
"object-shorthand": ["error", "properties"],
33+
indent: [
34+
"error",
35+
4,
36+
{
37+
SwitchCase: 1,
38+
},
39+
],
40+
quotes: ["error", "single"],
41+
semi: ["error", "always"],
42+
},
43+
},
44+
];

lib/errors/batch.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class BatchError extends Error {
102102
total: result.length,
103103
succeeded: result.length - e.length,
104104
failed: e.length,
105-
duration: duration
105+
duration
106106
};
107107

108108
this.getErrors = getErrors;
@@ -170,4 +170,3 @@ npm.utils.addInspection(BatchError, function () {
170170
});
171171

172172
module.exports = {BatchError};
173-

lib/ext/page.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ function page(source, options, config) {
117117
.then(next)
118118
.catch(error => {
119119
fail({
120-
error: error,
120+
error,
121121
dest: data
122122
}, 3, dest.name);
123123
});
@@ -130,9 +130,7 @@ function page(source, options, config) {
130130
return null; // this dummy return is just to prevent Bluebird warnings;
131131
})
132132
.catch(error => {
133-
fail({
134-
error: error
135-
}, 0);
133+
fail({error}, 0);
136134
});
137135
} else {
138136
fail({
@@ -160,7 +158,7 @@ function page(source, options, config) {
160158
function success() {
161159
resolve({
162160
pages: idx,
163-
total: total,
161+
total,
164162
duration: Date.now() - start
165163
});
166164
}

lib/ext/sequence.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function sequence(source, options, config) {
130130
})
131131
.catch(error => {
132132
fail({
133-
error: error,
133+
error,
134134
dest: data
135135
}, 2, dest.name);
136136
});

lib/ext/stream/read.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ function read(stream, receiver, options, config) {
178178
cleanup();
179179
resolve({
180180
calls: index,
181-
reads: reads,
182-
length: length,
181+
reads,
182+
length,
183183
duration: Date.now() - start
184184
});
185185
}

lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ function main(promiseLib) {
5353
promise = parsePromiseLib(promiseLib); // promise library parsing;
5454

5555
const config = {
56-
spex: spex,
57-
promise: promise,
56+
spex,
57+
promise,
5858
utils: npm.utils(promise)
5959
};
6060

lib/utils/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module.exports = function ($p) {
1010
isReadableStream: npm.stat.isReadableStream,
1111
messageGap: npm.stat.messageGap,
1212
extend: npm.stat.extend,
13-
resolve: resolve,
14-
wrap: wrap
13+
resolve,
14+
wrap
1515
};
1616

1717
return exp;

lib/utils/static.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function isReadableStream(obj) {
2121
// Sets an object property as read-only and non-enumerable.
2222
function extend(obj, name, value) {
2323
Object.defineProperty(obj, name, {
24-
value: value,
24+
value,
2525
configurable: false,
2626
enumerable: false,
2727
writable: false
@@ -65,10 +65,10 @@ function addInspection(type, cb) {
6565
}
6666

6767
module.exports = {
68-
addInspection: addInspection,
69-
formatError: formatError,
70-
isPromise: isPromise,
71-
isReadableStream: isReadableStream,
72-
messageGap: messageGap,
73-
extend: extend
68+
addInspection,
69+
formatError,
70+
isPromise,
71+
isReadableStream,
72+
messageGap,
73+
extend
7474
};

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"name": "spex",
3-
"version": "3.3.0",
3+
"version": "3.3.1",
44
"description": "Specialized Promise Extensions",
55
"main": "lib/index.js",
66
"typings": "typescript/spex.d.ts",
77
"scripts": {
88
"test": "jasmine-node test",
99
"doc": "jsdoc -c ./jsdoc/jsDoc.js ./jsdoc/README.md -u ./jsdoc/tutorials",
1010
"coverage": "istanbul cover ./node_modules/jasmine-node/bin/jasmine-node test",
11-
"travis": "npm run lint && istanbul cover ./node_modules/jasmine-node/bin/jasmine-node test --captureExceptions && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
1211
"browserify": "browserify lib/index.js -s spexLib -o spex.js",
1312
"lint": "eslint ./lib ./test/**/*.spec.js"
1413
},
@@ -37,16 +36,17 @@
3736
},
3837
"license": "MIT",
3938
"engines": {
40-
"node": ">=10.0.0"
39+
"node": ">=14.0.0"
4140
},
4241
"devDependencies": {
42+
"@eslint/js": "9.12.0",
4343
"bluebird": "3.7.2",
44-
"browserify": "17.0.0",
44+
"browserify": "17.0.1",
4545
"coveralls": "3.1.1",
46-
"eslint": "8.36.0",
46+
"eslint": "9.12.0",
4747
"istanbul": "0.4.5",
4848
"jasmine-node": "3.0.0",
49-
"jsdoc": "4.0.2",
50-
"typescript": "5.0.2"
49+
"jsdoc": "4.0.3",
50+
"typescript": "5.6.3"
5151
}
5252
}

test/ext/batch.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('Batch - negative', () => {
3535
throw err;
3636
}
3737

38-
spex.batch([1], {cb: cb})
38+
spex.batch([1], {cb})
3939
.catch(reason => {
4040
r = reason;
4141
done();
@@ -62,7 +62,7 @@ describe('Batch - negative', () => {
6262
throw err;
6363
}
6464

65-
spex.batch([promise.reject(rejectError)], {cb: cb})
65+
spex.batch([promise.reject(rejectError)], {cb})
6666
.catch(reason => {
6767
r = reason;
6868
done();
@@ -93,7 +93,7 @@ describe('Batch - negative', () => {
9393
return promise.reject(err);
9494
}
9595

96-
spex.batch([1, 2], {cb: cb})
96+
spex.batch([1, 2], {cb})
9797
.catch(reason => {
9898
r = reason;
9999
done();
@@ -312,7 +312,7 @@ describe('Batch callback as generator', () => {
312312
}
313313

314314
beforeEach(done => {
315-
spex.batch.call(context, [1], {cb: cb})
315+
spex.batch.call(context, [1], {cb})
316316
.then(data => {
317317
result = data;
318318
done();

test/ext/page.spec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ describe('Page - negative', () => {
149149
throw err;
150150
}
151151

152-
spex.page(source, {dest: dest})
152+
spex.page(source, {dest})
153153
.catch(reason => {
154154
r = reason;
155155
done();
@@ -178,7 +178,7 @@ describe('Page - negative', () => {
178178
return promise.reject(err);
179179
}
180180

181-
spex.page(source, {dest: dest})
181+
spex.page(source, {dest})
182182
.catch(reason => {
183183
r = reason;
184184
done();
@@ -303,7 +303,7 @@ describe('Page - positive', () => {
303303
}
304304

305305
beforeEach(done => {
306-
spex.page(source, {dest: dest})
306+
spex.page(source, {dest})
307307
.then(data => {
308308
result = data;
309309
done();
@@ -330,7 +330,7 @@ describe('Page - positive', () => {
330330
}
331331

332332
beforeEach(done => {
333-
spex.page(source, {limit: limit})
333+
spex.page(source, {limit})
334334
.then(data => {
335335
result = data;
336336
done();
@@ -382,7 +382,7 @@ describe('Page callbacks generators', () => {
382382
}
383383

384384
beforeEach(done => {
385-
spex.page.call(context, source, {dest: dest, limit: 1})
385+
spex.page.call(context, source, {dest, limit: 1})
386386
.then(data => {
387387
result = data;
388388
done();

test/ext/read.spec.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,7 @@ describe('Stream/Read - positive', () => {
173173
});
174174

175175
function receiver(index, data, delay) {
176-
r = {
177-
index: index,
178-
data: data,
179-
delay: delay
180-
};
176+
r = {index, data, delay};
181177
}
182178
});
183179

0 commit comments

Comments
 (0)