@react-pakistan/util-functions 1.19.2 → 1.20.0

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.
@@ -1,4 +0,0 @@
1
- import { IEmptyAction } from './types';
2
- type createEmptyAction<T extends string> = () => IEmptyAction<T>;
3
- export declare const emptyActionCreator: <T extends string>(actionType: T) => createEmptyAction<T>;
4
- export {};
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emptyActionCreator = void 0;
4
- const emptyActionCreator = (actionType) => () => ({ type: actionType });
5
- exports.emptyActionCreator = emptyActionCreator;
@@ -1,3 +0,0 @@
1
- export * from './payload-action-creator';
2
- export * from './empty-action-creator';
3
- export * from './types';
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./payload-action-creator"), exports);
18
- __exportStar(require("./empty-action-creator"), exports);
19
- __exportStar(require("./types"), exports);
@@ -1,4 +0,0 @@
1
- import { IPayloadAction } from './types';
2
- type createPayloadAction<T extends string, D> = (data: D) => IPayloadAction<T, D>;
3
- export declare const payloadActionCreator: <T extends string, D>(actionType: T) => createPayloadAction<T, D>;
4
- export {};
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.payloadActionCreator = void 0;
4
- const payloadActionCreator = (actionType) => (data) => ({ type: actionType, data });
5
- exports.payloadActionCreator = payloadActionCreator;
@@ -1,48 +0,0 @@
1
- export interface IEmptyAction<T extends string> {
2
- type: T;
3
- }
4
- export interface IActionData<D> {
5
- data: D;
6
- }
7
- export interface IPayloadAction<T extends string, D> extends IEmptyAction<T>, IActionData<D> {
8
- }
9
- export interface IAction {
10
- type: string;
11
- data?: any;
12
- }
13
- export type TActionCreator = (...args: Array<any>) => IAction;
14
- export type TAction<AC extends TActionCreator> = ReturnType<AC>;
15
- interface IMap {
16
- [K: string]: TActionCreator;
17
- }
18
- /**
19
- * Helper which returns a map of types of each action by creators passed in as a Map
20
- *
21
- * @example
22
- * import * as CfdActions from 'actions/cfd';
23
- * type CfdActionTypeMap = TActionMap<typeof CfdActions>;
24
- * type onChangeAction = TCfdActionMap['onChange']
25
- */
26
- export type TActionMap<T extends IMap> = {
27
- [K in keyof T]: TAction<T[K]>;
28
- };
29
- /**
30
- * Helper which combines the types of each action by creators passed in as a Map
31
- *
32
- * @example
33
- * import * as CfdActions from 'actions/cfd';
34
- * type CfdAction = TActionsMap<typeof CfdActions>;
35
- *
36
- * const test = (action : CfdAction) => {
37
- * if (action.type === 'onChange') {
38
- * // narrowed down to onChange action
39
- * }
40
- * switch (action.type) {
41
- * case 'onChange' : {
42
- * // narrowed down to onChange action
43
- * }
44
- * }
45
- * };
46
- */
47
- export type TActionsMap<T extends IMap> = TActionMap<T>[keyof TActionMap<T>];
48
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +0,0 @@
1
- /**
2
- * A util hook over react redux useSelector hook to enable memoization.
3
- *
4
- * @param selector - selector which needed to be memoized
5
- * @returns memoized value off the provided selector
6
- * @author Taimoor Khan
7
- * @remarks
8
- */
9
- /** End file docs */
10
- export declare const useSelector: (selector: () => void) => void;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- /**
3
- * A util hook over react redux useSelector hook to enable memoization.
4
- *
5
- * @param selector - selector which needed to be memoized
6
- * @returns memoized value off the provided selector
7
- * @author Taimoor Khan
8
- * @remarks
9
- */
10
- /** End file docs */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.useSelector = void 0;
13
- /* eslint-disable @typescript-eslint/no-explicit-any */
14
- const react_redux_1 = require("react-redux");
15
- const useSelector = (selector) => (0, react_redux_1.useSelector)(selector, react_redux_1.shallowEqual);
16
- exports.useSelector = useSelector;