@skmtc/core 0.0.449 → 0.0.450

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.
@@ -5,6 +5,7 @@ export declare class StackTrail {
5
5
  slice(start: number, end?: number): StackTrail;
6
6
  get stackTrail(): (string | number)[];
7
7
  append(frame: string | string[]): StackTrail;
8
+ getParentOf(frame: string): string | undefined;
8
9
  remove(frame: string | string[]): StackTrail;
9
10
  static join(...stacks: (StackTrail | string)[]): string;
10
11
  static parse(value: string): StackTrail;
@@ -1 +1 @@
1
- {"version":3,"file":"StackTrail.d.ts","sourceRoot":"","sources":["../../src/context/StackTrail.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;;gBAGT,KAAK,GAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAO;IAI3C,KAAK;IAIL,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAIjC,IAAI,UAAU,wBAEb;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAgB5C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAsB5C,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM;IAIvD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAYvC,QAAQ;CAOT"}
1
+ {"version":3,"file":"StackTrail.d.ts","sourceRoot":"","sources":["../../src/context/StackTrail.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;;gBAGT,KAAK,GAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAO;IAI3C,KAAK;IAIL,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAIjC,IAAI,UAAU,wBAEb;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAgB5C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAW9C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAsB5C,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM;IAIvD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAYvC,QAAQ;CAOT"}
@@ -35,6 +35,14 @@ export class StackTrail {
35
35
  }
36
36
  throw new Error(`Unexpected stack frame: ${frame}`);
37
37
  }
38
+ getParentOf(frame) {
39
+ const lastItemIndex = this.stackTrail.length - 1;
40
+ if (this.stackTrail?.[lastItemIndex] === frame &&
41
+ this.stackTrail?.[lastItemIndex - 1] === 'properties') {
42
+ const parentName = this.stackTrail?.[lastItemIndex - 2];
43
+ return typeof parentName === 'string' ? parentName : undefined;
44
+ }
45
+ }
38
46
  remove(frame) {
39
47
  if (typeof frame === 'string') {
40
48
  const lastItem = __classPrivateFieldGet(this, _StackTrail_stack, "f")[__classPrivateFieldGet(this, _StackTrail_stack, "f").length - 1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skmtc/core",
3
- "version": "0.0.449",
3
+ "version": "0.0.450",
4
4
  "main": "./script/mod.js",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -5,6 +5,7 @@ export declare class StackTrail {
5
5
  slice(start: number, end?: number): StackTrail;
6
6
  get stackTrail(): (string | number)[];
7
7
  append(frame: string | string[]): StackTrail;
8
+ getParentOf(frame: string): string | undefined;
8
9
  remove(frame: string | string[]): StackTrail;
9
10
  static join(...stacks: (StackTrail | string)[]): string;
10
11
  static parse(value: string): StackTrail;
@@ -1 +1 @@
1
- {"version":3,"file":"StackTrail.d.ts","sourceRoot":"","sources":["../../src/context/StackTrail.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;;gBAGT,KAAK,GAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAO;IAI3C,KAAK;IAIL,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAIjC,IAAI,UAAU,wBAEb;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAgB5C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAsB5C,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM;IAIvD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAYvC,QAAQ;CAOT"}
1
+ {"version":3,"file":"StackTrail.d.ts","sourceRoot":"","sources":["../../src/context/StackTrail.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;;gBAGT,KAAK,GAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAO;IAI3C,KAAK;IAIL,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM;IAIjC,IAAI,UAAU,wBAEb;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAgB5C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAW9C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU;IAsB5C,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM;IAIvD,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAYvC,QAAQ;CAOT"}
@@ -38,6 +38,14 @@ class StackTrail {
38
38
  }
39
39
  throw new Error(`Unexpected stack frame: ${frame}`);
40
40
  }
41
+ getParentOf(frame) {
42
+ const lastItemIndex = this.stackTrail.length - 1;
43
+ if (this.stackTrail?.[lastItemIndex] === frame &&
44
+ this.stackTrail?.[lastItemIndex - 1] === 'properties') {
45
+ const parentName = this.stackTrail?.[lastItemIndex - 2];
46
+ return typeof parentName === 'string' ? parentName : undefined;
47
+ }
48
+ }
41
49
  remove(frame) {
42
50
  if (typeof frame === 'string') {
43
51
  const lastItem = __classPrivateFieldGet(this, _StackTrail_stack, "f")[__classPrivateFieldGet(this, _StackTrail_stack, "f").length - 1];