@open-tender/utils 0.1.1 → 0.1.3
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.
- package/dist/cjs/utils/helpers.d.ts +7 -24
- package/dist/cjs/utils/helpers.js +10 -1
- package/dist/esm/utils/helpers.d.ts +7 -24
- package/dist/esm/utils/helpers.js +8 -0
- package/package.json +1 -1
- package/dist/cjs/utils/platform.d.ts +0 -0
- package/dist/cjs/utils/platform.js +0 -1
- package/dist/esm/utils/platform.d.ts +0 -0
- package/dist/esm/utils/platform.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Announcements, ContentImages, GuestData } from '@open-tender/types';
|
|
1
|
+
import { Announcements, ContentImages, GuestData, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
2
|
export declare const isString: (str: any) => boolean;
|
|
3
3
|
export declare const isObject: (obj: any) => boolean;
|
|
4
4
|
export declare const isEmpty: (obj?: object | null) => boolean;
|
|
@@ -29,31 +29,14 @@ export declare const makeRandomNumberString: () => string;
|
|
|
29
29
|
export declare const getWidth: () => number;
|
|
30
30
|
export declare const getHeight: () => number;
|
|
31
31
|
export declare const makeImageUrl: (images: ContentImages, isMobile: boolean) => string | null | undefined;
|
|
32
|
-
export declare const makeSlides: (items: Announcements, isMobile: boolean) =>
|
|
33
|
-
imageUrl: string | null | undefined;
|
|
34
|
-
announcement_id: number;
|
|
35
|
-
display_order: number;
|
|
36
|
-
hide_text: boolean;
|
|
37
|
-
hide_text_mobile: boolean;
|
|
38
|
-
horizontal: string;
|
|
39
|
-
images: ContentImages;
|
|
40
|
-
overlay_color: string;
|
|
41
|
-
overlay_opacity: number;
|
|
42
|
-
show_overlay: boolean;
|
|
43
|
-
subtitle: string;
|
|
44
|
-
subtitle_color: string;
|
|
45
|
-
subtitle_size: string | number | null;
|
|
46
|
-
text_color: string;
|
|
47
|
-
title: string;
|
|
48
|
-
title_color: string;
|
|
49
|
-
title_size: string | number | null;
|
|
50
|
-
url: string | null;
|
|
51
|
-
url_text: string | null;
|
|
52
|
-
vertical: string;
|
|
53
|
-
imageUri?: string | undefined;
|
|
54
|
-
}[] | null;
|
|
32
|
+
export declare const makeSlides: (items: Announcements, isMobile: boolean) => Announcements | null;
|
|
55
33
|
export declare const displayPrice: (price: string) => string;
|
|
56
34
|
export declare const addCommas: (x: number, d: number) => string;
|
|
57
35
|
export declare const formatQuantity: (n: string) => string;
|
|
58
36
|
export declare const formatDollars: (str: string, space?: string, decimals?: number) => string;
|
|
59
37
|
export declare const convertStringToArray: (str: string | null) => string[];
|
|
38
|
+
export declare const hasEntities: <T extends unknown[]>(reducer: {
|
|
39
|
+
entities: T;
|
|
40
|
+
loading: RequestStatus;
|
|
41
|
+
error: RequestError;
|
|
42
|
+
}) => number | false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertStringToArray = exports.formatDollars = exports.formatQuantity = exports.addCommas = exports.displayPrice = exports.makeSlides = exports.makeImageUrl = exports.getHeight = exports.getWidth = exports.makeRandomNumberString = exports.checkGuestData = exports.checkEmpty = exports.validateEmail = exports.dashesToSlashes = exports.slashesToDashes = exports.makeBirthDate = exports.validatePhone = exports.makePhone = exports.cleanPhone = exports.capitalize = exports.serialize = exports.stripTags = exports.slugify = exports.contains = exports.isNum = exports.isEmpty = exports.isObject = exports.isString = void 0;
|
|
3
|
+
exports.hasEntities = exports.convertStringToArray = exports.formatDollars = exports.formatQuantity = exports.addCommas = exports.displayPrice = exports.makeSlides = exports.makeImageUrl = exports.getHeight = exports.getWidth = exports.makeRandomNumberString = exports.checkGuestData = exports.checkEmpty = exports.validateEmail = exports.dashesToSlashes = exports.slashesToDashes = exports.makeBirthDate = exports.validatePhone = exports.makePhone = exports.cleanPhone = exports.capitalize = exports.serialize = exports.stripTags = exports.slugify = exports.contains = exports.isNum = exports.isEmpty = exports.isObject = exports.isString = void 0;
|
|
4
4
|
const isString = (str) => {
|
|
5
5
|
return typeof str === 'string';
|
|
6
6
|
};
|
|
@@ -178,3 +178,12 @@ const convertStringToArray = (str) => {
|
|
|
178
178
|
: [];
|
|
179
179
|
};
|
|
180
180
|
exports.convertStringToArray = convertStringToArray;
|
|
181
|
+
const hasEntities = (reducer) => {
|
|
182
|
+
if (!reducer)
|
|
183
|
+
return false;
|
|
184
|
+
const { entities, loading, error } = reducer;
|
|
185
|
+
if (loading === 'pending' && !entities.length)
|
|
186
|
+
return false;
|
|
187
|
+
return !error && entities.length;
|
|
188
|
+
};
|
|
189
|
+
exports.hasEntities = hasEntities;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Announcements, ContentImages, GuestData } from '@open-tender/types';
|
|
1
|
+
import { Announcements, ContentImages, GuestData, RequestError, RequestStatus } from '@open-tender/types';
|
|
2
2
|
export declare const isString: (str: any) => boolean;
|
|
3
3
|
export declare const isObject: (obj: any) => boolean;
|
|
4
4
|
export declare const isEmpty: (obj?: object | null) => boolean;
|
|
@@ -29,31 +29,14 @@ export declare const makeRandomNumberString: () => string;
|
|
|
29
29
|
export declare const getWidth: () => number;
|
|
30
30
|
export declare const getHeight: () => number;
|
|
31
31
|
export declare const makeImageUrl: (images: ContentImages, isMobile: boolean) => string | null | undefined;
|
|
32
|
-
export declare const makeSlides: (items: Announcements, isMobile: boolean) =>
|
|
33
|
-
imageUrl: string | null | undefined;
|
|
34
|
-
announcement_id: number;
|
|
35
|
-
display_order: number;
|
|
36
|
-
hide_text: boolean;
|
|
37
|
-
hide_text_mobile: boolean;
|
|
38
|
-
horizontal: string;
|
|
39
|
-
images: ContentImages;
|
|
40
|
-
overlay_color: string;
|
|
41
|
-
overlay_opacity: number;
|
|
42
|
-
show_overlay: boolean;
|
|
43
|
-
subtitle: string;
|
|
44
|
-
subtitle_color: string;
|
|
45
|
-
subtitle_size: string | number | null;
|
|
46
|
-
text_color: string;
|
|
47
|
-
title: string;
|
|
48
|
-
title_color: string;
|
|
49
|
-
title_size: string | number | null;
|
|
50
|
-
url: string | null;
|
|
51
|
-
url_text: string | null;
|
|
52
|
-
vertical: string;
|
|
53
|
-
imageUri?: string | undefined;
|
|
54
|
-
}[] | null;
|
|
32
|
+
export declare const makeSlides: (items: Announcements, isMobile: boolean) => Announcements | null;
|
|
55
33
|
export declare const displayPrice: (price: string) => string;
|
|
56
34
|
export declare const addCommas: (x: number, d: number) => string;
|
|
57
35
|
export declare const formatQuantity: (n: string) => string;
|
|
58
36
|
export declare const formatDollars: (str: string, space?: string, decimals?: number) => string;
|
|
59
37
|
export declare const convertStringToArray: (str: string | null) => string[];
|
|
38
|
+
export declare const hasEntities: <T extends unknown[]>(reducer: {
|
|
39
|
+
entities: T;
|
|
40
|
+
loading: RequestStatus;
|
|
41
|
+
error: RequestError;
|
|
42
|
+
}) => number | false;
|
|
@@ -147,3 +147,11 @@ export const convertStringToArray = (str) => {
|
|
|
147
147
|
.filter(i => i.length)
|
|
148
148
|
: [];
|
|
149
149
|
};
|
|
150
|
+
export const hasEntities = (reducer) => {
|
|
151
|
+
if (!reducer)
|
|
152
|
+
return false;
|
|
153
|
+
const { entities, loading, error } = reducer;
|
|
154
|
+
if (loading === 'pending' && !entities.length)
|
|
155
|
+
return false;
|
|
156
|
+
return !error && entities.length;
|
|
157
|
+
};
|
package/package.json
CHANGED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|