@tim-code/my-util 0.0.21 → 0.0.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tim-code/my-util",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "author": "",
package/src/fs.js CHANGED
@@ -1,5 +1,4 @@
1
- import { writeFile } from "node:fs"
2
- import { readFile, stat } from "node:fs/promises"
1
+ import { readFile, stat, writeFile } from "node:fs/promises"
3
2
  import { tmpdir } from "node:os"
4
3
  import { promisify } from "node:util"
5
4
  import { gunzip as _gunzip } from "node:zlib"
package/src/fs.test.js CHANGED
@@ -8,8 +8,6 @@ const writeFileMock = jest.fn()
8
8
  jest.unstable_mockModule("node:fs/promises", () => ({
9
9
  readFile: readFileMock,
10
10
  stat: statMock,
11
- }))
12
- jest.unstable_mockModule("node:fs", () => ({
13
11
  writeFile: writeFileMock,
14
12
  }))
15
13
  jest.unstable_mockModule("node:os", () => ({
package/src/promise.js CHANGED
@@ -88,7 +88,9 @@ export async function allSettled({ array, limit, flatten = false }, callback) {
88
88
  export function alert(result) {
89
89
  const { errors } = result ?? {}
90
90
  if (errors && errors.length) {
91
- throw new Error(JSON.stringify(errors, undefined, 2))
91
+ // coerce errors to strings since sometimes .stringify() won't do this for Error objects
92
+ const strings = errors.map((error) => error.toString())
93
+ throw new Error(JSON.stringify(strings, undefined, 2))
92
94
  }
93
95
  return result
94
96
  }