dce-reactkit 3.7.34 → 3.7.36

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.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Capitalize every word in a string (just the first letter)
3
+ * @param str string to capitalize
4
+ * @returns string with every word capitalized
5
+ */
6
+ declare const capitalize: (str: string) => string;
7
+ export default capitalize;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shuffle a given array
3
+ * @author Austen Money
4
+ * @param arr the array to shuffle
5
+ * @returns the shuffled array
6
+ */
7
+ declare const shuffleArray: <T>(arr: T[]) => T[];
8
+ export default shuffleArray;
@@ -75,6 +75,8 @@ import filterAsync from './helpers/asyncArrayFunctions/filterAsync';
75
75
  import forEachAsync from './helpers/asyncArrayFunctions/forEachAsync';
76
76
  import mapAsync from './helpers/asyncArrayFunctions/mapAsync';
77
77
  import someAsync from './helpers/asyncArrayFunctions/someAsync';
78
+ import capitalize from './helpers/capitalize';
79
+ import shuffleArray from './helpers/shuffleArray';
78
80
  import ModalButtonType from './types/ModalButtonType';
79
81
  import ModalSize from './types/ModalSize';
80
82
  import ModalType from './types/ModalType';
@@ -94,4 +96,4 @@ import PickableItem from './components/ItemPicker/types/PickableItem';
94
96
  import DBEntry from './components/DBEntryManagerPanel/types/DBEntry';
95
97
  import DBEntryField from './components/DBEntryManagerPanel/types/DBEntryField';
96
98
  import DBEntryFieldType from './components/DBEntryManagerPanel/types/DBEntryFieldType';
97
- export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, IntelliTableColumn, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
99
+ export { AppWrapper, LoadingSpinner, ErrorBox, Modal, TabBox, RadioButton, CheckboxButton, ButtonInputGroup, SimpleDateChooser, Drawer, PopSuccessMark, PopFailureMark, PopPendingMark, CopiableBox, ItemPicker, LogReviewer, IntelliTable, CSVDownloadButton, DBEntryManagerPanel, Tooltip, ToggleSwitch, AutoscrollToBottomContainer, MultiSwitch, alert, confirm, showFatalError, ErrorWithCode, MINUTE_IN_MS, HOUR_IN_MS, DAY_IN_MS, DynamicWord, abbreviate, avg, ceilToNumDecimals, floorToNumDecimals, forceNumIntoBounds, padDecimalZeros, padZerosLeft, roundToNumDecimals, sum, waitMs, getOrdinal, getTimeInfoInET, stubServerEndpoint, startMinWait, getHumanReadableDate, getPartOfDay, stringsToHumanReadableList, onlyKeepLetters, parallelLimit, getMonthName, genCSV, canReviewLogs, isMobileOrTablet, extractProp, compareArraysByProp, genCommaList, validateEmail, validatePhoneNumber, validateString, getLocalTimeInfo, idify, makeLinksClickable, prefixWithAOrAn, everyAsync, filterAsync, forEachAsync, mapAsync, someAsync, capitalize, shuffleArray, initClient, visitServerEndpoint, logClientEvent, addFatalErrorHandler, leaveToURL, combineClassNames, useForceRender, setClientEventMetadataPopulator, initServer, genRouteHandler, handleError, handleSuccess, initLogCollection, addDBEditorEndpoints, ModalButtonType, ModalSize, ModalType, ReactKitErrorCode, Variant, DayOfWeek, Log, LogType, LogSource, LogAction, LogBuiltInMetadata, LogMetadataType, LogFunction, IntelliTableColumn, PickableItem, DBEntry, DBEntryField, DBEntryFieldType, ParamType, };
package/dist/index.d.ts CHANGED
@@ -1552,6 +1552,21 @@ declare const someAsync: <T>(array: T[], operatorFunction: (item: T, index: numb
1552
1552
  array: T[];
1553
1553
  }) => Promise<any>) => Promise<boolean>;
1554
1554
 
1555
+ /**
1556
+ * Capitalize every word in a string (just the first letter)
1557
+ * @param str string to capitalize
1558
+ * @returns string with every word capitalized
1559
+ */
1560
+ declare const capitalize: (str: string) => string;
1561
+
1562
+ /**
1563
+ * Shuffle a given array
1564
+ * @author Austen Money
1565
+ * @param arr the array to shuffle
1566
+ * @returns the shuffled array
1567
+ */
1568
+ declare const shuffleArray: <T>(arr: T[]) => T[];
1569
+
1555
1570
  /**
1556
1571
  * List of error codes built into the react kit
1557
1572
  * @author Gabe Abrams
@@ -1602,4 +1617,4 @@ declare const LogBuiltInMetadata: {
1602
1617
  };
1603
1618
  };
1604
1619
 
1605
- export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
1620
+ export { AppWrapper, AutoscrollToBottomContainer, ButtonInputGroup, CSVDownloadButton, CheckboxButton, CopiableBox, DAY_IN_MS, DBEntry, DBEntryField, DBEntryFieldType, DBEntryManagerPanel, DayOfWeek, Drawer, DynamicWord, ErrorBox, ErrorWithCode, HOUR_IN_MS, IntelliTable, IntelliTableColumn, ItemPicker, LoadingSpinner, Log, LogAction, LogBuiltInMetadata, LogFunction, LogMetadataType, LogReviewer, LogSource, LogType, MINUTE_IN_MS, Modal, ModalButtonType, ModalSize, ModalType, MultiSwitch, ParamType, PickableItem, PopFailureMark, PopPendingMark, PopSuccessMark, RadioButton, ReactKitErrorCode, SimpleDateChooser, TabBox, ToggleSwitch, Tooltip, Variant, abbreviate, addDBEditorEndpoints, addFatalErrorHandler, alert, avg, canReviewLogs, capitalize, ceilToNumDecimals, combineClassNames, compareArraysByProp, confirm, everyAsync, extractProp, filterAsync, floorToNumDecimals, forEachAsync, forceNumIntoBounds, genCSV, genCommaList, genRouteHandler, getHumanReadableDate, getLocalTimeInfo, getMonthName, getOrdinal, getPartOfDay, getTimeInfoInET, handleError, handleSuccess, idify, initClient, initLogCollection, initServer, isMobileOrTablet, leaveToURL, logClientEvent, makeLinksClickable, mapAsync, onlyKeepLetters, padDecimalZeros, padZerosLeft, parallelLimit, prefixWithAOrAn, roundToNumDecimals, setClientEventMetadataPopulator, showFatalError, shuffleArray, someAsync, startMinWait, stringsToHumanReadableList, stubServerEndpoint, sum, useForceRender, validateEmail, validatePhoneNumber, validateString, visitServerEndpoint, waitMs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.7.34",
3
+ "version": "3.7.36",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Capitalize every word in a string (just the first letter)
3
+ * @param str string to capitalize
4
+ * @returns string with every word capitalized
5
+ */
6
+ const capitalize = (str: string): string => {
7
+ return (
8
+ str
9
+ // Split into words
10
+ .split(' ')
11
+ // Capitalize first letter of each word
12
+ .map((word) => {
13
+ return word.charAt(0).toUpperCase() + word.substring(1);
14
+ })
15
+ // Join back together
16
+ .join(' ')
17
+ );
18
+ };
19
+
20
+ export default capitalize;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Shuffle a given array
3
+ * @author Austen Money
4
+ * @param arr the array to shuffle
5
+ * @returns the shuffled array
6
+ */
7
+ const shuffleArray = <T>(arr: T[]): T[] => {
8
+ const newArr = [...arr];
9
+
10
+ // Shuffle using Durstenfeld algorithm
11
+ for (let i = arr.length - 1; i > 0; i--) {
12
+ const j = Math.floor(Math.random() * (i + 1));
13
+ [newArr[i], newArr[j]] = [newArr[j], newArr[i]];
14
+ }
15
+
16
+ return newArr;
17
+ };
18
+
19
+ export default shuffleArray;
package/src/index.ts CHANGED
@@ -90,6 +90,8 @@ import filterAsync from './helpers/asyncArrayFunctions/filterAsync';
90
90
  import forEachAsync from './helpers/asyncArrayFunctions/forEachAsync';
91
91
  import mapAsync from './helpers/asyncArrayFunctions/mapAsync';
92
92
  import someAsync from './helpers/asyncArrayFunctions/someAsync';
93
+ import capitalize from './helpers/capitalize';
94
+ import shuffleArray from './helpers/shuffleArray';
93
95
 
94
96
  // Import types
95
97
  import ModalButtonType from './types/ModalButtonType';
@@ -191,6 +193,8 @@ export {
191
193
  forEachAsync,
192
194
  mapAsync,
193
195
  someAsync,
196
+ capitalize,
197
+ shuffleArray,
194
198
  // Client helpers
195
199
  initClient,
196
200
  visitServerEndpoint,