Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10696d0

Browse files
committed
refactor(state): add void transform to actions
1 parent fe09200 commit 10696d0

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
22
* @description
33
* This transform is a side effecting operation applying `preventDefault` to a passed Event
4-
* @param e
54
*/
65
export function preventDefault(e: Event): Event {
76
e.preventDefault();
@@ -11,7 +10,6 @@ export function preventDefault(e: Event): Event {
1110
/**
1211
* @description
1312
* This transform is a side effecting operation applying `stopPropagation` to a passed Event
14-
* @param e
1513
*/
1614
export function stopPropagation(e: Event): Event {
1715
e.stopPropagation();
@@ -21,24 +19,30 @@ export function stopPropagation(e: Event): Event {
2119
/**
2220
* @description
2321
* This transform is a side effecting operation applying `preventDefault` and `stopPropagation` to a passed Event
24-
* @param e
2522
*/
2623
export function preventDefaultStopPropagation(e: Event): Event {
2724
e.stopPropagation();
2825
e.preventDefault();
2926
return e;
3027
}
3128

32-
3329
/**
3430
* @description
35-
* This transform is helps to pluck values from DOM `Event` or forward the value directly.
36-
* @param e
31+
* This transform helps to pluck values from DOM `Event` or forward the value directly.
3732
*/
3833
export function eventValue<T = string>(e: Event | T): T {
3934
// Consider https://stackoverflow.com/questions/1458894/how-to-determine-if-javascript-object-is-an-event
40-
if((e as unknown as {target: {value: T}})?.target) {
41-
return (e as unknown as {target: {value: T}})?.target?.value;
35+
if ((e as unknown as { target: { value: T } })?.target) {
36+
return (e as unknown as { target: { value: T } })?.target?.value;
4237
}
4338
return e as T;
4439
}
40+
41+
/**
42+
* @description
43+
* This transform helps to void all arguments.
44+
*/
45+
export function toVoid(_?: unknown): void {
46+
_;
47+
return void 0;
48+
}

0 commit comments

Comments
 (0)