@xylabs/function-name 3.6.12 → 4.0.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.
Files changed (48) hide show
  1. package/dist/neutral/index.d.ts +3 -2
  2. package/package.json +8 -27
  3. package/xy.config.ts +12 -0
  4. package/dist/browser/functionName.d.cts +0 -2
  5. package/dist/browser/functionName.d.cts.map +0 -1
  6. package/dist/browser/functionName.d.mts +0 -2
  7. package/dist/browser/functionName.d.mts.map +0 -1
  8. package/dist/browser/functionName.d.ts +0 -2
  9. package/dist/browser/functionName.d.ts.map +0 -1
  10. package/dist/browser/index.cjs +0 -48
  11. package/dist/browser/index.cjs.map +0 -1
  12. package/dist/browser/index.d.cts +0 -2
  13. package/dist/browser/index.d.cts.map +0 -1
  14. package/dist/browser/index.d.mts +0 -2
  15. package/dist/browser/index.d.mts.map +0 -1
  16. package/dist/browser/index.d.ts +0 -2
  17. package/dist/browser/index.d.ts.map +0 -1
  18. package/dist/browser/index.mjs +0 -25
  19. package/dist/browser/index.mjs.map +0 -1
  20. package/dist/neutral/functionName.d.cts +0 -2
  21. package/dist/neutral/functionName.d.cts.map +0 -1
  22. package/dist/neutral/functionName.d.mts +0 -2
  23. package/dist/neutral/functionName.d.mts.map +0 -1
  24. package/dist/neutral/functionName.d.ts +0 -2
  25. package/dist/neutral/functionName.d.ts.map +0 -1
  26. package/dist/neutral/index.cjs +0 -48
  27. package/dist/neutral/index.cjs.map +0 -1
  28. package/dist/neutral/index.d.cts +0 -2
  29. package/dist/neutral/index.d.cts.map +0 -1
  30. package/dist/neutral/index.d.mts +0 -2
  31. package/dist/neutral/index.d.mts.map +0 -1
  32. package/dist/neutral/index.d.ts.map +0 -1
  33. package/dist/node/functionName.d.cts +0 -2
  34. package/dist/node/functionName.d.cts.map +0 -1
  35. package/dist/node/functionName.d.mts +0 -2
  36. package/dist/node/functionName.d.mts.map +0 -1
  37. package/dist/node/functionName.d.ts +0 -2
  38. package/dist/node/functionName.d.ts.map +0 -1
  39. package/dist/node/index.cjs +0 -53
  40. package/dist/node/index.cjs.map +0 -1
  41. package/dist/node/index.d.cts +0 -2
  42. package/dist/node/index.d.cts.map +0 -1
  43. package/dist/node/index.d.mts +0 -2
  44. package/dist/node/index.d.mts.map +0 -1
  45. package/dist/node/index.d.ts +0 -2
  46. package/dist/node/index.d.ts.map +0 -1
  47. package/dist/node/index.mjs +0 -26
  48. package/dist/node/index.mjs.map +0 -1
@@ -1,2 +1,3 @@
1
- export * from './functionName.ts';
2
- //# sourceMappingURL=index.d.ts.map
1
+ declare const functionName: (depth?: number) => string;
2
+
3
+ export { functionName };
package/package.json CHANGED
@@ -11,11 +11,11 @@
11
11
  },
12
12
  "description": "Primary SDK for using XYO Protocol 2.0",
13
13
  "dependencies": {
14
- "@xylabs/error": "^3.6.12"
14
+ "@xylabs/error": "^4.0.0"
15
15
  },
16
16
  "devDependencies": {
17
- "@xylabs/ts-scripts-yarn3": "^3.15.14",
18
- "@xylabs/tsconfig": "^3.15.14",
17
+ "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
18
+ "@xylabs/tsconfig": "^4.0.0-rc.15",
19
19
  "typescript": "^5.5.4"
20
20
  },
21
21
  "engines": {
@@ -23,32 +23,13 @@
23
23
  },
24
24
  "exports": {
25
25
  ".": {
26
- "browser": {
27
- "require": {
28
- "types": "./dist/browser/index.d.cts",
29
- "default": "./dist/browser/index.cjs"
30
- },
31
- "import": {
32
- "types": "./dist/browser/index.d.ts",
33
- "default": "./dist/browser/index.mjs"
34
- }
35
- },
36
- "node": {
37
- "require": {
38
- "types": "./dist/node/index.d.cts",
39
- "default": "./dist/node/index.cjs"
40
- },
41
- "import": {
42
- "types": "./dist/node/index.d.ts",
43
- "default": "./dist/node/index.mjs"
44
- }
45
- }
26
+ "types": "./dist/neutral/index.d.ts",
27
+ "default": "./dist/neutral/index.mjs"
46
28
  },
47
29
  "./package.json": "./package.json"
48
30
  },
49
- "main": "dist/node/index.cjs",
50
- "module": "dist/node/index.mjs",
51
- "types": "dist/node/index.d.ts",
31
+ "module": "dist/neutral/index.mjs",
32
+ "types": "dist/neutral/index.d.ts",
52
33
  "homepage": "https://xyo.network",
53
34
  "license": "LGPL-3.0-only",
54
35
  "publishConfig": {
@@ -67,6 +48,6 @@
67
48
  "esm"
68
49
  ],
69
50
  "sideEffects": false,
70
- "version": "3.6.12",
51
+ "version": "4.0.0",
71
52
  "type": "module"
72
53
  }
package/xy.config.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
+ const config: XyTsupConfig = {
3
+ compile: {
4
+ browser: {},
5
+ neutral: {
6
+ src: true,
7
+ },
8
+ node: {},
9
+ },
10
+ }
11
+
12
+ export default config
@@ -1,2 +0,0 @@
1
- export declare const functionName: (depth?: number) => string;
2
- //# sourceMappingURL=functionName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const functionName: (depth?: number) => string;
2
- //# sourceMappingURL=functionName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const functionName: (depth?: number) => string;
2
- //# sourceMappingURL=functionName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- functionName: () => functionName
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
-
27
- // src/functionName.ts
28
- var import_error = require("@xylabs/error");
29
- var functionName = (depth = 2) => {
30
- try {
31
- throw new Error("Getting function name");
32
- } catch (ex) {
33
- return (0, import_error.handleError)(ex, (error) => {
34
- let newIndex;
35
- const stackParts = error.stack?.split("\n")[depth].split(" ");
36
- const funcName = stackParts?.find((item, index) => {
37
- if (item.length > 0 && item !== "at") {
38
- if (item === "new") {
39
- newIndex = index;
40
- }
41
- return item;
42
- }
43
- }) ?? "<unknown>";
44
- return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName;
45
- });
46
- }
47
- };
48
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/functionName.ts"],"sourcesContent":["export * from './functionName.ts'\n","import { handleError } from '@xylabs/error'\n\nexport const functionName = (depth = 2) => {\n try {\n throw new Error('Getting function name')\n } catch (ex) {\n return handleError(ex, (error) => {\n let newIndex: number | undefined\n const stackParts = error.stack?.split('\\n')[depth].split(' ')\n const funcName\n = stackParts?.find((item, index) => {\n if (item.length > 0 && item !== 'at') {\n // check if constructor\n if (item === 'new') {\n newIndex = index\n }\n return item\n }\n }) ?? '<unknown>'\n return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA4B;AAErB,IAAM,eAAe,CAAC,QAAQ,MAAM;AACzC,MAAI;AACF,UAAM,IAAI,MAAM,uBAAuB;AAAA,EACzC,SAAS,IAAI;AACX,eAAO,0BAAY,IAAI,CAAC,UAAU;AAChC,UAAI;AACJ,YAAM,aAAa,MAAM,OAAO,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG;AAC5D,YAAM,WACF,YAAY,KAAK,CAAC,MAAM,UAAU;AAClC,YAAI,KAAK,SAAS,KAAK,SAAS,MAAM;AAEpC,cAAI,SAAS,OAAO;AAClB,uBAAW;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,MACF,CAAC,KAAK;AACR,aAAO,WAAW,GAAG,QAAQ,IAAI,aAAa,WAAW,CAAC,CAAC,KAAK;AAAA,IAClE,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -1,2 +0,0 @@
1
- export * from './functionName.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './functionName.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './functionName.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,25 +0,0 @@
1
- // src/functionName.ts
2
- import { handleError } from "@xylabs/error";
3
- var functionName = (depth = 2) => {
4
- try {
5
- throw new Error("Getting function name");
6
- } catch (ex) {
7
- return handleError(ex, (error) => {
8
- let newIndex;
9
- const stackParts = error.stack?.split("\n")[depth].split(" ");
10
- const funcName = stackParts?.find((item, index) => {
11
- if (item.length > 0 && item !== "at") {
12
- if (item === "new") {
13
- newIndex = index;
14
- }
15
- return item;
16
- }
17
- }) ?? "<unknown>";
18
- return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName;
19
- });
20
- }
21
- };
22
- export {
23
- functionName
24
- };
25
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/functionName.ts"],"sourcesContent":["import { handleError } from '@xylabs/error'\n\nexport const functionName = (depth = 2) => {\n try {\n throw new Error('Getting function name')\n } catch (ex) {\n return handleError(ex, (error) => {\n let newIndex: number | undefined\n const stackParts = error.stack?.split('\\n')[depth].split(' ')\n const funcName\n = stackParts?.find((item, index) => {\n if (item.length > 0 && item !== 'at') {\n // check if constructor\n if (item === 'new') {\n newIndex = index\n }\n return item\n }\n }) ?? '<unknown>'\n return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName\n })\n }\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAErB,IAAM,eAAe,CAAC,QAAQ,MAAM;AACzC,MAAI;AACF,UAAM,IAAI,MAAM,uBAAuB;AAAA,EACzC,SAAS,IAAI;AACX,WAAO,YAAY,IAAI,CAAC,UAAU;AAChC,UAAI;AACJ,YAAM,aAAa,MAAM,OAAO,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG;AAC5D,YAAM,WACF,YAAY,KAAK,CAAC,MAAM,UAAU;AAClC,YAAI,KAAK,SAAS,KAAK,SAAS,MAAM;AAEpC,cAAI,SAAS,OAAO;AAClB,uBAAW;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,MACF,CAAC,KAAK;AACR,aAAO,WAAW,GAAG,QAAQ,IAAI,aAAa,WAAW,CAAC,CAAC,KAAK;AAAA,IAClE,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -1,2 +0,0 @@
1
- export declare const functionName: (depth?: number) => string;
2
- //# sourceMappingURL=functionName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const functionName: (depth?: number) => string;
2
- //# sourceMappingURL=functionName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const functionName: (depth?: number) => string;
2
- //# sourceMappingURL=functionName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- functionName: () => functionName
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
-
27
- // src/functionName.ts
28
- var import_error = require("@xylabs/error");
29
- var functionName = (depth = 2) => {
30
- try {
31
- throw new Error("Getting function name");
32
- } catch (ex) {
33
- return (0, import_error.handleError)(ex, (error) => {
34
- let newIndex;
35
- const stackParts = error.stack?.split("\n")[depth].split(" ");
36
- const funcName = stackParts?.find((item, index) => {
37
- if (item.length > 0 && item !== "at") {
38
- if (item === "new") {
39
- newIndex = index;
40
- }
41
- return item;
42
- }
43
- }) ?? "<unknown>";
44
- return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName;
45
- });
46
- }
47
- };
48
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/functionName.ts"],"sourcesContent":["export * from './functionName.ts'\n","import { handleError } from '@xylabs/error'\n\nexport const functionName = (depth = 2) => {\n try {\n throw new Error('Getting function name')\n } catch (ex) {\n return handleError(ex, (error) => {\n let newIndex: number | undefined\n const stackParts = error.stack?.split('\\n')[depth].split(' ')\n const funcName\n = stackParts?.find((item, index) => {\n if (item.length > 0 && item !== 'at') {\n // check if constructor\n if (item === 'new') {\n newIndex = index\n }\n return item\n }\n }) ?? '<unknown>'\n return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA4B;AAErB,IAAM,eAAe,CAAC,QAAQ,MAAM;AACzC,MAAI;AACF,UAAM,IAAI,MAAM,uBAAuB;AAAA,EACzC,SAAS,IAAI;AACX,eAAO,0BAAY,IAAI,CAAC,UAAU;AAChC,UAAI;AACJ,YAAM,aAAa,MAAM,OAAO,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG;AAC5D,YAAM,WACF,YAAY,KAAK,CAAC,MAAM,UAAU;AAClC,YAAI,KAAK,SAAS,KAAK,SAAS,MAAM;AAEpC,cAAI,SAAS,OAAO;AAClB,uBAAW;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,MACF,CAAC,KAAK;AACR,aAAO,WAAW,GAAG,QAAQ,IAAI,aAAa,WAAW,CAAC,CAAC,KAAK;AAAA,IAClE,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -1,2 +0,0 @@
1
- export * from './functionName.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './functionName.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const functionName: (depth?: number) => string;
2
- //# sourceMappingURL=functionName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const functionName: (depth?: number) => string;
2
- //# sourceMappingURL=functionName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const functionName: (depth?: number) => string;
2
- //# sourceMappingURL=functionName.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- functionName: () => functionName
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
-
27
- // src/functionName.ts
28
- var import_error = require("@xylabs/error");
29
- var functionName = (depth = 2) => {
30
- try {
31
- throw new Error("Getting function name");
32
- } catch (ex) {
33
- return (0, import_error.handleError)(ex, (error) => {
34
- var _a;
35
- let newIndex;
36
- const stackParts = (_a = error.stack) == null ? void 0 : _a.split("\n")[depth].split(" ");
37
- const funcName = (stackParts == null ? void 0 : stackParts.find((item, index) => {
38
- if (item.length > 0 && item !== "at") {
39
- if (item === "new") {
40
- newIndex = index;
41
- }
42
- return item;
43
- }
44
- })) ?? "<unknown>";
45
- return newIndex ? `${funcName} ${stackParts == null ? void 0 : stackParts[newIndex + 1]}` : funcName;
46
- });
47
- }
48
- };
49
- // Annotate the CommonJS export names for ESM import in node:
50
- 0 && (module.exports = {
51
- functionName
52
- });
53
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/functionName.ts"],"sourcesContent":["export * from './functionName.ts'\n","import { handleError } from '@xylabs/error'\n\nexport const functionName = (depth = 2) => {\n try {\n throw new Error('Getting function name')\n } catch (ex) {\n return handleError(ex, (error) => {\n let newIndex: number | undefined\n const stackParts = error.stack?.split('\\n')[depth].split(' ')\n const funcName\n = stackParts?.find((item, index) => {\n if (item.length > 0 && item !== 'at') {\n // check if constructor\n if (item === 'new') {\n newIndex = index\n }\n return item\n }\n }) ?? '<unknown>'\n return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA4B;AAErB,IAAM,eAAe,CAAC,QAAQ,MAAM;AACzC,MAAI;AACF,UAAM,IAAI,MAAM,uBAAuB;AAAA,EACzC,SAAS,IAAI;AACX,eAAO,0BAAY,IAAI,CAAC,UAAU;AANtC;AAOM,UAAI;AACJ,YAAM,cAAa,WAAM,UAAN,mBAAa,MAAM,MAAM,OAAO,MAAM;AACzD,YAAM,YACF,yCAAY,KAAK,CAAC,MAAM,UAAU;AAClC,YAAI,KAAK,SAAS,KAAK,SAAS,MAAM;AAEpC,cAAI,SAAS,OAAO;AAClB,uBAAW;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,MACF,OAAM;AACR,aAAO,WAAW,GAAG,QAAQ,IAAI,yCAAa,WAAW,EAAE,KAAK;AAAA,IAClE,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -1,2 +0,0 @@
1
- export * from './functionName.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './functionName.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './functionName.ts';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
@@ -1,26 +0,0 @@
1
- // src/functionName.ts
2
- import { handleError } from "@xylabs/error";
3
- var functionName = (depth = 2) => {
4
- try {
5
- throw new Error("Getting function name");
6
- } catch (ex) {
7
- return handleError(ex, (error) => {
8
- var _a;
9
- let newIndex;
10
- const stackParts = (_a = error.stack) == null ? void 0 : _a.split("\n")[depth].split(" ");
11
- const funcName = (stackParts == null ? void 0 : stackParts.find((item, index) => {
12
- if (item.length > 0 && item !== "at") {
13
- if (item === "new") {
14
- newIndex = index;
15
- }
16
- return item;
17
- }
18
- })) ?? "<unknown>";
19
- return newIndex ? `${funcName} ${stackParts == null ? void 0 : stackParts[newIndex + 1]}` : funcName;
20
- });
21
- }
22
- };
23
- export {
24
- functionName
25
- };
26
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/functionName.ts"],"sourcesContent":["import { handleError } from '@xylabs/error'\n\nexport const functionName = (depth = 2) => {\n try {\n throw new Error('Getting function name')\n } catch (ex) {\n return handleError(ex, (error) => {\n let newIndex: number | undefined\n const stackParts = error.stack?.split('\\n')[depth].split(' ')\n const funcName\n = stackParts?.find((item, index) => {\n if (item.length > 0 && item !== 'at') {\n // check if constructor\n if (item === 'new') {\n newIndex = index\n }\n return item\n }\n }) ?? '<unknown>'\n return newIndex ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName\n })\n }\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAErB,IAAM,eAAe,CAAC,QAAQ,MAAM;AACzC,MAAI;AACF,UAAM,IAAI,MAAM,uBAAuB;AAAA,EACzC,SAAS,IAAI;AACX,WAAO,YAAY,IAAI,CAAC,UAAU;AANtC;AAOM,UAAI;AACJ,YAAM,cAAa,WAAM,UAAN,mBAAa,MAAM,MAAM,OAAO,MAAM;AACzD,YAAM,YACF,yCAAY,KAAK,CAAC,MAAM,UAAU;AAClC,YAAI,KAAK,SAAS,KAAK,SAAS,MAAM;AAEpC,cAAI,SAAS,OAAO;AAClB,uBAAW;AAAA,UACb;AACA,iBAAO;AAAA,QACT;AAAA,MACF,OAAM;AACR,aAAO,WAAW,GAAG,QAAQ,IAAI,yCAAa,WAAW,EAAE,KAAK;AAAA,IAClE,CAAC;AAAA,EACH;AACF;","names":[]}