File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 66 * @template Type
77 */
88export abstract class Value < Type > {
9+ /**
10+ * @description Returns the `string` tag representation of the `Value` class when used in `Object.prototype.toString.call(instance)`.
11+ * @public
12+ * @readonly
13+ * @type {string }
14+ */
15+ public get [ Symbol . toStringTag ] ( ) {
16+ return 'Value' ;
17+ }
18+
919 /**
1020 * @description Returns the privately stored value of generic type variable `Type`.
1121 * @public
@@ -32,6 +42,16 @@ export abstract class Value<Type> {
3242 this . #value = value ;
3343 }
3444
45+ /**
46+ * @description Extracts the string tag of the current instance defined by the `Symbol.toStringTag`.
47+ * @public
48+ * @returns {string | undefined } The extracted class name, such as `'Value'`, or `undefined` if extraction fails.
49+ */
50+ public get tag ( ) : string | undefined {
51+ const tag = Object . prototype . toString . call ( this ) . slice ( 8 , - 1 ) ;
52+ return tag !== 'Object' ? tag : undefined ;
53+ }
54+
3555 /**
3656 * @description Sets the value of generic type variable `Type`.
3757 * @protected
You can’t perform that action at this time.
0 commit comments