-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
61 lines (55 loc) · 1.28 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* These functions must run in the browser, do not use Node APIs.
*/
import { slugify } from "./slugify/index";
import {
removeSpecialCharacters,
insertSpecialCharacters,
sanitiseForDb,
sanitiseForTsv,
} from "./handleSpecialCharacters/index";
import {
buildTableRows,
parseUpdates,
buildUnitTableRows,
parseUnitUpdates,
} from "./bulkUploads/index";
import { createSlackReport } from "./reportToSlack/index";
export {
slugify,
removeSpecialCharacters,
insertSpecialCharacters,
buildTableRows,
parseUpdates,
buildUnitTableRows,
parseUnitUpdates,
sanitiseForDb,
sanitiseForTsv,
createSlackReport,
};
// When bundled for the browser, this object
// will be exposed on the Window object as
// `OakRetoolHelpers`.
const oakRetoolHelpers = {
slugify,
removeSpecialCharacters,
insertSpecialCharacters,
buildTableRows,
parseUpdates,
buildUnitTableRows,
parseUnitUpdates,
sanitiseForDb,
sanitiseForTsv,
createSlackReport,
};
declare global {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface Window {
OakRetoolHelpers: typeof oakRetoolHelpers;
}
}
if (typeof window !== "undefined") {
window.OakRetoolHelpers = oakRetoolHelpers;
}
// Expose a default export for convenience.
export default oakRetoolHelpers;