Skip to content

Commit f3a4ed7

Browse files
authored
Merge pull request #2 from typescript-package/develop
v1.0.0 updated docs
2 parents 9b2aaba + 47c4ed7 commit f3a4ed7

File tree

8 files changed

+30
-76
lines changed

8 files changed

+30
-76
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ export class ActiveState extends BooleanState {
7878
}
7979
}
8080

81+
// Initialize.
82+
const activeState = new ActiveState();
83+
84+
// Deactivate the initial state.
85+
activeState.deactivate();
8186
```
8287

8388
### `EnumState`
@@ -149,7 +154,7 @@ numberedState.increment();
149154
// Increment state by 5.
150155
numberedState.increment(5);
151156

152-
// Reset state to 0..
157+
// Reset state to 0.
153158
numberedState.reset();
154159
```
155160

src/lib/boolean-state.abstract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Abstract.
22
import { State } from "./state.abstract";
33
/**
4-
* @description Handles the boolean state.
4+
* @description Handles the `boolean` type state.
55
* @export
66
* @abstract
77
* @class BooleanState

src/lib/enum-state.abstract.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Abstract.
22
import { State } from "./state.abstract";
33
/**
4-
* @description
4+
* @description Handles the `enum` type state.
55
* @export
66
* @abstract
77
* @class EnumState
@@ -23,7 +23,13 @@ export abstract class EnumState<
2323
constructor(state: T, enumObject: EnumObject) {
2424
super(state);
2525
}
26-
26+
27+
/**
28+
* @description Checks whether the state is of the specific enum.
29+
* @public
30+
* @param {T} state The specific enum to check whether state is.
31+
* @returns {boolean}
32+
*/
2733
public is(state: T) {
2834
return super.state === state;
2935
}

src/lib/immutable-state.abstract.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @description
2+
* @description Manages the immutability states of `this` current instance.
33
* @export
44
* @abstract
55
* @class ImmutableState
@@ -26,7 +26,7 @@ export abstract class ImmutableState {
2626
}
2727

2828
/**
29-
* @description
29+
* @description Checks whether `this` current instance is frozen.
3030
* @public
3131
* @returns {boolean}
3232
*/
@@ -53,7 +53,7 @@ export abstract class ImmutableState {
5353
}
5454

5555
/**
56-
* @description
56+
* @description Checks whether `this` current instance is sealed.
5757
* @public
5858
* @returns {boolean}
5959
*/

src/lib/null-state.abstract.ts

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Abstract.
22
import { State } from "./state.abstract";
33
/**
4-
* @description
4+
* @description Handles and manages the `null` type state.
55
* @export
66
* @abstract
77
* @class NullState
@@ -19,7 +19,7 @@ export abstract class NullState extends State<null | undefined> {
1919
}
2020

2121
/**
22-
* @description
22+
* @description Checks whether state is `null`.
2323
* @public
2424
* @returns {boolean}
2525
*/
@@ -39,7 +39,7 @@ export abstract class NullState extends State<null | undefined> {
3939
}
4040

4141
/**
42-
* @description
42+
* @description Removes the `null` state.
4343
* @public
4444
* @returns {this}
4545
*/
@@ -48,64 +48,3 @@ export abstract class NullState extends State<null | undefined> {
4848
return this;
4949
}
5050
}
51-
52-
53-
54-
55-
56-
57-
58-
59-
60-
61-
62-
63-
64-
65-
66-
67-
68-
69-
70-
71-
72-
73-
74-
75-
76-
77-
78-
79-
80-
81-
82-
83-
84-
85-
86-
87-
88-
89-
90-
91-
// export abstract class NullState<T> {
92-
// private state: T | null;
93-
94-
// constructor(initialState: T | null = null) {
95-
// this.state = initialState;
96-
// }
97-
98-
// public get value(): T | null {
99-
// return this.state;
100-
// }
101-
102-
// public set(value: T): this {
103-
// this.state = value;
104-
// return this;
105-
// }
106-
107-
// public clear(): this {
108-
// this.state = null;
109-
// return this;
110-
// }
111-
// }

src/lib/number-state.abstract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Abstract.
22
import { State } from "./state.abstract";
33
/**
4-
* @description Handles the number state.
4+
* @description Handles and manages the `number` type state.
55
* @export
66
* @abstract
77
* @class NumberState

src/lib/state.abstract.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Abstract.
22
import { ImmutableState } from "./immutable-state.abstract";
33
/**
4-
* @description
4+
* @description Common class for setting the state of `Type`.
55
* @export
66
* @abstract
77
* @class State
@@ -11,7 +11,7 @@ import { ImmutableState } from "./immutable-state.abstract";
1111
*/
1212
export abstract class State<Type> extends ImmutableState {
1313
/**
14-
* @description
14+
* @description Returns the current state of `Type`.
1515
* @public
1616
* @readonly
1717
* @type {Type}
@@ -21,7 +21,7 @@ export abstract class State<Type> extends ImmutableState {
2121
}
2222

2323
/**
24-
* @description
24+
* @description Privately stored state of `Type`.
2525
* @private
2626
* @type {Type}
2727
*/
@@ -30,7 +30,7 @@ export abstract class State<Type> extends ImmutableState {
3030
/**
3131
* Creates an instance of parent class.
3232
* @constructor
33-
* @param {Type} [initialState]
33+
* @param {Type} [initialState] Initial state of `Type`.
3434
*/
3535
constructor(initialState: Type) {
3636
super();

src/test/boolean-state.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ export class ActiveState extends BooleanState {
1818
super.false();
1919
}
2020
}
21+
22+
const activeState = new ActiveState();
23+
24+
activeState.deactivate();

0 commit comments

Comments
 (0)