@dvrd/dvr-controls 1.1.11 → 1.1.12
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/package.json +1 -1
- package/src/js/util/miscUtil.ts +8 -5
package/package.json
CHANGED
package/src/js/util/miscUtil.ts
CHANGED
|
@@ -102,7 +102,7 @@ export const downloadFile = (blob: Blob, fileName: string) => {
|
|
|
102
102
|
link.click();
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
export const downloadRequiredFile = (path: string | {
|
|
105
|
+
export const downloadRequiredFile = (path: string | {default: string}, fileName?: string) => {
|
|
106
106
|
if (typeof path !== 'string') path = path.default;
|
|
107
107
|
const name = getFileName(path, fileName);
|
|
108
108
|
const link = document.createElement('a');
|
|
@@ -147,11 +147,14 @@ export function nullify<T extends string | Array<any> | Set<any> | number | bigi
|
|
|
147
147
|
else if (value instanceof Set)
|
|
148
148
|
return value.size ? value : null;
|
|
149
149
|
return null;
|
|
150
|
-
}
|
|
150
|
+
}
|
|
151
151
|
|
|
152
|
-
export
|
|
153
|
-
|
|
154
|
-
};
|
|
152
|
+
export function undefine<T>(value?: T | null): T | undefined {
|
|
153
|
+
if (value === null || value === undefined) return undefined;
|
|
154
|
+
if (value.hasOwnProperty('length') && !(value as unknown as {length: number}).length) return undefined;
|
|
155
|
+
if (value instanceof Set && !value.size) return undefined;
|
|
156
|
+
return value;
|
|
157
|
+
}
|
|
155
158
|
|
|
156
159
|
export const sanitizeHtml = (html: string) => {
|
|
157
160
|
return DOMPurify().sanitize(html);
|