foxts 3.11.1 → 3.12.0

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.
@@ -0,0 +1,10 @@
1
+ interface ErrorLikeObject {
2
+ name: string;
3
+ message: string;
4
+ stack?: string;
5
+ }
6
+ declare function isErrorLikeObject(obj: unknown): obj is ErrorLikeObject;
7
+ declare function extractErrorMessage(error: unknown, includeName?: boolean, includeStack?: boolean): string | null;
8
+
9
+ export { extractErrorMessage, isErrorLikeObject };
10
+ export type { ErrorLikeObject };
@@ -0,0 +1 @@
1
+ function e(e){return"object"==typeof e&&null!==e&&"name"in e&&"string"==typeof e.name&&"message"in e&&"string"==typeof e.message&&(!("stack"in e)||"string"==typeof e.stack)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.extractErrorMessage=function(t,r=!0,n=!1){if(!e(t))return null;let s="";return r&&(s+=t.name,s+=": "),s+=t.message,n&&"stack"in t&&"string"==typeof t.stack&&(s+="\n"+t.stack),s.trim()},exports.isErrorLikeObject=e;
@@ -0,0 +1 @@
1
+ function t(t){return"object"==typeof t&&null!==t&&"name"in t&&"string"==typeof t.name&&"message"in t&&"string"==typeof t.message&&(!("stack"in t)||"string"==typeof t.stack)}function e(n,r=!0,s=!1){if(!t(n))return null;let i="";return r&&(i+=n.name,i+=": "),i+=n.message,s&&"stack"in n&&"string"==typeof n.stack&&(i+="\n"+n.stack),i.trim()}export{e as extractErrorMessage,t as isErrorLikeObject};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foxts",
3
- "version": "3.11.1",
3
+ "version": "3.12.0",
4
4
  "description": "Opinionated collection of common TypeScript utils by @SukkaW",
5
5
  "repository": {
6
6
  "url": "https://github.com/SukkaW/foxts"
@@ -224,6 +224,12 @@
224
224
  "import": "./dist/chunk.mjs",
225
225
  "require": "./dist/chunk.js",
226
226
  "default": "./dist/chunk.js"
227
+ },
228
+ "./extract-error-message": {
229
+ "types": "./dist/extract-error-message.d.ts",
230
+ "import": "./dist/extract-error-message.mjs",
231
+ "require": "./dist/extract-error-message.js",
232
+ "default": "./dist/extract-error-message.js"
227
233
  }
228
234
  },
229
235
  "sideEffects": false,
@@ -244,10 +250,10 @@
244
250
  "@mitata/counters": "^0.0.8",
245
251
  "@monyone/aho-corasick": "^1.0.4",
246
252
  "@package-json/types": "^0.0.11",
247
- "@swc-node/register": "^1.10.10",
248
- "@swc/core": "^1.13.3",
253
+ "@swc-node/register": "^1.11.1",
254
+ "@swc/core": "^1.13.4",
249
255
  "@types/mocha": "^10.0.10",
250
- "@types/node": "^22.17.1",
256
+ "@types/node": "^22.17.2",
251
257
  "@types/sinon": "^17.0.4",
252
258
  "bumpp": "^10.2.3",
253
259
  "bunchee": "^6.6.0",
@@ -257,7 +263,7 @@
257
263
  "eslint-formatter-sukka": "^6.23.1",
258
264
  "expect": "^30.0.5",
259
265
  "fastscan": "^1.0.6",
260
- "fdir": "^6.4.6",
266
+ "fdir": "^6.5.0",
261
267
  "mitata": "^1.0.34",
262
268
  "mocha": "^11.7.1",
263
269
  "modern-ahocorasick": "^2.0.4",
@@ -266,7 +272,7 @@
266
272
  },
267
273
  "scripts": {
268
274
  "lint": "eslint --format=sukka .",
269
- "test": "SWC_NODE_IGNORE_DYNAMIC=1 SWC_NODE_PROJECT=tsconfig.test-swc.json nyc mocha --require @swc-node/register --full-trace ./src/**/*.test.ts",
275
+ "test": "SWC_NODE_IGNORE_DYNAMIC=1 SWC_NODE_INLINE_SOURCE_MAP=1 nyc mocha --require @swc-node/register --full-trace ./src/**/*.test.ts",
270
276
  "bench": "SWC_NODE_IGNORE_DYNAMIC=1 node --require @swc-node/register",
271
277
  "bench:all": "SWC_NODE_IGNORE_DYNAMIC=1 node --require @swc-node/register ./src/**/*.bench.ts",
272
278
  "prebuild": "bunchee prepare && node -r @swc-node/register ./tools/index.ts",