@xylabs/function-name 5.0.80 → 5.0.82
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 +2 -2
- package/package.json +5 -8
- package/src/functionName.ts +0 -24
- package/src/index.ts +0 -1
package/README.md
CHANGED
|
@@ -34,12 +34,12 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
34
34
|
***
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
|
-
function functionName(depth): string;
|
|
37
|
+
function functionName(depth?): string;
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Parameters
|
|
41
41
|
|
|
42
|
-
### depth
|
|
42
|
+
### depth?
|
|
43
43
|
|
|
44
44
|
`number` = `2`
|
|
45
45
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/function-name",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.82",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"function",
|
|
@@ -30,28 +30,25 @@
|
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
32
|
"types": "./dist/neutral/index.d.ts",
|
|
33
|
-
"source": "./src/index.ts",
|
|
34
33
|
"default": "./dist/neutral/index.mjs"
|
|
35
34
|
},
|
|
36
35
|
"./package.json": "./package.json"
|
|
37
36
|
},
|
|
38
37
|
"module": "./dist/neutral/index.mjs",
|
|
39
|
-
"source": "./src/index.ts",
|
|
40
38
|
"types": "./dist/neutral/index.d.ts",
|
|
41
39
|
"files": [
|
|
42
40
|
"dist",
|
|
43
|
-
"src",
|
|
44
41
|
"!**/*.bench.*",
|
|
45
42
|
"!**/*.spec.*",
|
|
46
43
|
"!**/*.test.*"
|
|
47
44
|
],
|
|
48
45
|
"dependencies": {
|
|
49
|
-
"@xylabs/error": "~5.0.
|
|
50
|
-
"@xylabs/typeof": "~5.0.
|
|
46
|
+
"@xylabs/error": "~5.0.82",
|
|
47
|
+
"@xylabs/typeof": "~5.0.82"
|
|
51
48
|
},
|
|
52
49
|
"devDependencies": {
|
|
53
|
-
"@xylabs/ts-scripts-yarn3": "~7.
|
|
54
|
-
"@xylabs/tsconfig": "~7.
|
|
50
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.11",
|
|
51
|
+
"@xylabs/tsconfig": "~7.4.11",
|
|
55
52
|
"typescript": "~5.9.3",
|
|
56
53
|
"vitest": "~4.0.18"
|
|
57
54
|
},
|
package/src/functionName.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { handleError } from '@xylabs/error'
|
|
2
|
-
import { isNumber } from '@xylabs/typeof'
|
|
3
|
-
|
|
4
|
-
export const functionName = (depth = 2) => {
|
|
5
|
-
try {
|
|
6
|
-
throw new Error('Getting function name')
|
|
7
|
-
} catch (ex) {
|
|
8
|
-
return handleError(ex, (error) => {
|
|
9
|
-
let newIndex: number | undefined
|
|
10
|
-
const stackParts = error.stack?.split('\n')[depth].split(' ')
|
|
11
|
-
const funcName
|
|
12
|
-
= stackParts?.find((item, index) => {
|
|
13
|
-
if (item.length > 0 && item !== 'at') {
|
|
14
|
-
// check if constructor
|
|
15
|
-
if (item === 'new') {
|
|
16
|
-
newIndex = index
|
|
17
|
-
}
|
|
18
|
-
return true
|
|
19
|
-
}
|
|
20
|
-
}) ?? '<unknown>'
|
|
21
|
-
return isNumber(newIndex) ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './functionName.ts'
|