@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.
- package/dist/neutral/index.d.ts +3 -2
- package/package.json +8 -27
- package/xy.config.ts +12 -0
- package/dist/browser/functionName.d.cts +0 -2
- package/dist/browser/functionName.d.cts.map +0 -1
- package/dist/browser/functionName.d.mts +0 -2
- package/dist/browser/functionName.d.mts.map +0 -1
- package/dist/browser/functionName.d.ts +0 -2
- package/dist/browser/functionName.d.ts.map +0 -1
- package/dist/browser/index.cjs +0 -48
- package/dist/browser/index.cjs.map +0 -1
- package/dist/browser/index.d.cts +0 -2
- package/dist/browser/index.d.cts.map +0 -1
- package/dist/browser/index.d.mts +0 -2
- package/dist/browser/index.d.mts.map +0 -1
- package/dist/browser/index.d.ts +0 -2
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.mjs +0 -25
- package/dist/browser/index.mjs.map +0 -1
- package/dist/neutral/functionName.d.cts +0 -2
- package/dist/neutral/functionName.d.cts.map +0 -1
- package/dist/neutral/functionName.d.mts +0 -2
- package/dist/neutral/functionName.d.mts.map +0 -1
- package/dist/neutral/functionName.d.ts +0 -2
- package/dist/neutral/functionName.d.ts.map +0 -1
- package/dist/neutral/index.cjs +0 -48
- package/dist/neutral/index.cjs.map +0 -1
- package/dist/neutral/index.d.cts +0 -2
- package/dist/neutral/index.d.cts.map +0 -1
- package/dist/neutral/index.d.mts +0 -2
- package/dist/neutral/index.d.mts.map +0 -1
- package/dist/neutral/index.d.ts.map +0 -1
- package/dist/node/functionName.d.cts +0 -2
- package/dist/node/functionName.d.cts.map +0 -1
- package/dist/node/functionName.d.mts +0 -2
- package/dist/node/functionName.d.mts.map +0 -1
- package/dist/node/functionName.d.ts +0 -2
- package/dist/node/functionName.d.ts.map +0 -1
- package/dist/node/index.cjs +0 -53
- package/dist/node/index.cjs.map +0 -1
- package/dist/node/index.d.cts +0 -2
- package/dist/node/index.d.cts.map +0 -1
- package/dist/node/index.d.mts +0 -2
- package/dist/node/index.d.mts.map +0 -1
- package/dist/node/index.d.ts +0 -2
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/index.mjs +0 -26
- package/dist/node/index.mjs.map +0 -1
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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": "^
|
|
14
|
+
"@xylabs/error": "^4.0.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
18
|
-
"@xylabs/tsconfig": "^
|
|
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
|
-
"
|
|
27
|
-
|
|
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
|
-
"
|
|
50
|
-
"
|
|
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": "
|
|
51
|
+
"version": "4.0.0",
|
|
71
52
|
"type": "module"
|
|
72
53
|
}
|
package/xy.config.ts
ADDED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
|
package/dist/browser/index.cjs
DELETED
|
@@ -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":[]}
|
package/dist/browser/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/browser/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/browser/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/browser/index.mjs
DELETED
|
@@ -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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
|
package/dist/neutral/index.cjs
DELETED
|
@@ -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":[]}
|
package/dist/neutral/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/neutral/index.d.mts
DELETED
|
@@ -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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functionName.d.ts","sourceRoot":"","sources":["../../src/functionName.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,4BAoBxB,CAAA"}
|
package/dist/node/index.cjs
DELETED
|
@@ -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
|
package/dist/node/index.cjs.map
DELETED
|
@@ -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":[]}
|
package/dist/node/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/node/index.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/node/index.d.ts
DELETED
package/dist/node/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/node/index.mjs
DELETED
|
@@ -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
|
package/dist/node/index.mjs.map
DELETED
|
@@ -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":[]}
|