@util.js/promises 0.41.3 → 0.41.5

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
@@ -4,7 +4,6 @@
4
4
 
5
5
  <p>
6
6
  <a href="https://www.npmjs.com/package/@util.js/promises"><img alt="NPM Status" src="https://img.shields.io/npm/v/@util.js/promises.svg?style=flat"></a>
7
- <a href="https://travis-ci.org/creemama/utiljs"><img alt="Travis CI Build Status" src="https://img.shields.io/travis/creemama/utiljs/master.svg?style=flat-square&label=Travis+CI"></a>
8
7
  </p>
9
8
 
10
9
  @util.js/promises is part of [Util.js](https://github.com/creemama/utiljs).
@@ -318,7 +317,7 @@ promises.callPromise(
318
317
  notifyPromise,
319
318
  "Call back",
320
319
  "Hypnotoad",
321
- (error, message) => console.log(message)
320
+ (error, message) => console.log(message),
322
321
  );
323
322
  ```
324
323
 
package/dist/Promises.js CHANGED
@@ -17,7 +17,7 @@ var Promises = /*#__PURE__*/function () {
17
17
  function Promises() {
18
18
  (0, _classCallCheck2["default"])(this, Promises);
19
19
  }
20
- (0, _createClass2["default"])(Promises, [{
20
+ return (0, _createClass2["default"])(Promises, [{
21
21
  key: "all",
22
22
  value:
23
23
  /**
@@ -215,7 +215,6 @@ var Promises = /*#__PURE__*/function () {
215
215
  // This should be caught by
216
216
  // process.on('unhandledRejection', error => { ... });
217
217
  };
218
-
219
218
  callbackifyCache().set(promiseFunction, returnValue);
220
219
  return returnValue;
221
220
  }
@@ -427,7 +426,6 @@ var Promises = /*#__PURE__*/function () {
427
426
  return _promise["default"].resolve.apply(_promise["default"], arguments);
428
427
  }
429
428
  }]);
430
- return Promises;
431
429
  }();
432
430
  module.exports = Promises;
433
431
  var dependencies = {};
@@ -172,7 +172,7 @@ function runExample7() {
172
172
  return;
173
173
  }
174
174
  console.log(message);
175
- }
175
+ },
176
176
  );
177
177
  }
178
178
 
package/lib/Promises.js CHANGED
@@ -176,13 +176,13 @@ class Promises {
176
176
  if (returnValue) return returnValue;
177
177
  if (typeof promiseFunction !== "function")
178
178
  throw new TypeError(
179
- `We expected promiseFunction to be function, but it was ${promiseFunction}.`
179
+ `We expected promiseFunction to be function, but it was ${promiseFunction}.`,
180
180
  );
181
181
  returnValue = function (...args) {
182
182
  const callback = arguments[args.length - 1];
183
183
  if (typeof callback !== "function")
184
184
  throw new TypeError(
185
- `We expected callback to be a function, but it was ${callback}.`
185
+ `We expected callback to be a function, but it was ${callback}.`,
186
186
  );
187
187
  const argsWithoutCalback = Array.from(args).slice(0, args.length - 1);
188
188
  let promise;
@@ -193,7 +193,7 @@ class Promises {
193
193
  }
194
194
  if (!promise && !promise.then)
195
195
  throw new Error(
196
- `We expected promiseFunction to return a Promise but instead got ${promise}.`
196
+ `We expected promiseFunction to return a Promise but instead got ${promise}.`,
197
197
  );
198
198
  promise.then((result) => callback(null, result)).catch(callback);
199
199
  // It is possible for the callback to throw an error.
@@ -303,7 +303,7 @@ class Promises {
303
303
  if (returnValue) return returnValue;
304
304
  if (typeof functionWithCallback !== "function")
305
305
  throw new TypeError(
306
- `We expected functionWithCallback to be a function, but it was ${functionWithCallback}.`
306
+ `We expected functionWithCallback to be a function, but it was ${functionWithCallback}.`,
307
307
  );
308
308
  returnValue = function (...args) {
309
309
  const thiz = this;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Chris Topher <c@creemama.com>",
3
3
  "dependencies": {
4
- "@babel/runtime-corejs3": "7.21.0"
4
+ "@babel/runtime-corejs3": "7.29.7"
5
5
  },
6
6
  "dependencies-comments": [
7
7
  "@babel/runtime-corejs3 is required by files in the dist directory to ",
@@ -28,6 +28,5 @@
28
28
  "type": "git",
29
29
  "url": "https://github.com/creemama/utiljs/tree/master/packages/utiljs-promises"
30
30
  },
31
- "version": "0.41.3",
32
- "gitHead": "e17139b7f85c3abec178d8facdacc2aa6c5bb553"
31
+ "version": "0.41.5"
33
32
  }
@@ -12,24 +12,24 @@ describe("Promises", function () {
12
12
  }
13
13
  it("should resolve a Promise", async function () {
14
14
  expect(
15
- await promises.applyCallback(null, notify, ["Promise me", "Hypnotoad"])
15
+ await promises.applyCallback(null, notify, ["Promise me", "Hypnotoad"]),
16
16
  ).to.eql("Promise me, Hypnotoad!");
17
17
  expect(
18
- await promises.callCallback(null, notify, "Promise me", "Hypnotoad")
18
+ await promises.callCallback(null, notify, "Promise me", "Hypnotoad"),
19
19
  ).to.eql("Promise me, Hypnotoad!");
20
20
  });
21
21
  it("should error if functionOnObjectWithCallback is not a function", () => {
22
22
  expect(() =>
23
- promises.applyCallback(null, null, ["Promise me", "Hypnotoad"])
23
+ promises.applyCallback(null, null, ["Promise me", "Hypnotoad"]),
24
24
  ).to.throw(TypeError);
25
25
  expect(() =>
26
- promises.callCallback(null, null, "Promise me", "Hypnotoad")
26
+ promises.callCallback(null, null, "Promise me", "Hypnotoad"),
27
27
  ).to.throw(TypeError);
28
28
  expect(() =>
29
- promises.applyCallback(null, "a", ["Promise me", "Hypnotoad"])
29
+ promises.applyCallback(null, "a", ["Promise me", "Hypnotoad"]),
30
30
  ).to.throw(TypeError);
31
31
  expect(() =>
32
- promises.callCallback(null, "a", "Promise me", "Hypnotoad")
32
+ promises.callCallback(null, "a", "Promise me", "Hypnotoad"),
33
33
  ).to.throw(TypeError);
34
34
  });
35
35
  it("should error if args is erroneous", () => {
@@ -97,7 +97,7 @@ describe("Promises", function () {
97
97
  }
98
98
  expect(message).to.eql("Call back, Hypnotoad!");
99
99
  c(callbck);
100
- }
100
+ },
101
101
  );
102
102
  }
103
103
  function c(callbck) {
@@ -121,22 +121,22 @@ describe("Promises", function () {
121
121
  } catch (err) {
122
122
  callbck(err);
123
123
  }
124
- }
124
+ },
125
125
  );
126
126
  }
127
127
  });
128
128
  it("should error if promiseFunction is not a function", () => {
129
129
  expect(() =>
130
- promises.applyPromise(null, null, ["Call back", "Hypnotoad"])
130
+ promises.applyPromise(null, null, ["Call back", "Hypnotoad"]),
131
131
  ).to.throw(TypeError);
132
132
  expect(() =>
133
- promises.callPromise(null, null, "Call back", "Hypnotoad")
133
+ promises.callPromise(null, null, "Call back", "Hypnotoad"),
134
134
  ).to.throw(TypeError);
135
135
  expect(() =>
136
- promises.applyPromise(null, "a", ["Call back", "Hypnotoad"])
136
+ promises.applyPromise(null, "a", ["Call back", "Hypnotoad"]),
137
137
  ).to.throw(TypeError);
138
138
  expect(() =>
139
- promises.callPromise(null, "a", "Call back", "Hypnotoad")
139
+ promises.callPromise(null, "a", "Call back", "Hypnotoad"),
140
140
  ).to.throw(TypeError);
141
141
  });
142
142
  it("should handle erroneous input", (callback) => {
@@ -219,11 +219,11 @@ describe("Promises", function () {
219
219
  callback(
220
220
  new Error(
221
221
  "We expected #callPromise to not call this callback.",
222
- { cause: error }
223
- )
222
+ { cause: error },
223
+ ),
224
224
  );
225
- }
226
- )
225
+ },
226
+ ),
227
227
  ).to.throw(Error);
228
228
  callbck();
229
229
  } catch (error) {
@@ -298,20 +298,20 @@ describe("Promises", function () {
298
298
  cb();
299
299
  }
300
300
  expect(() => promises.applyCallback(null, functionWithCallback)).to.throw(
301
- TypeError
301
+ TypeError,
302
302
  );
303
303
  expect(() =>
304
- promises.applyCallback(null, functionWithCallback, null)
304
+ promises.applyCallback(null, functionWithCallback, null),
305
305
  ).to.throw(TypeError);
306
306
  // The following line sends functionWithCallback the wrong number of arguments.
307
307
  expect(() =>
308
- promises.applyCallback(null, functionWithCallback, "a")
308
+ promises.applyCallback(null, functionWithCallback, "a"),
309
309
  ).to.throw(TypeError);
310
310
  expect(() => promises.applyCallback(null, null, [() => {}])).to.throw(
311
- TypeError
311
+ TypeError,
312
312
  );
313
313
  expect(() => promises.applyCallback(null, "a", [() => {}])).to.throw(
314
- TypeError
314
+ TypeError,
315
315
  );
316
316
  expect(() => promises.applyCallback(null, null, [])).to.throw(TypeError);
317
317
  expect(() => promises.applyCallback(null, "a", [])).to.throw(TypeError);
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright 2018 Chris Topher (c@creemama.com)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
- of the Software, and to permit persons to whom the Software is furnished to do
10
- so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.