This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Construct a type based off T where TDefinedField is defined when | |
| * T matches TDefinedState. | |
| * | |
| * @example | |
| * ```ts | |
| * type Payload = DefinedWhen< | |
| * { | |
| * isFetched: boolean; | |
| * hasError: boolean; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Recursively converts a type to a new type. The `predicateFn` is | |
| * used to determine if the `converterFn` should be run on the value. | |
| * | |
| * The function first checks the value itself, if the `predicateFn` returns | |
| * false and the value is an array or object, the function will recursively | |
| * check each item in the array or object. | |
| * | |
| * @param value - The value to convert primitive types in. | |
| * @param predicateFn - A function that returns true if the `converterFn` should |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Format bytes as human-readable text. | |
| * @param {number} bytes Number of bytes. | |
| * @param {number} decimalPlaces Number of decimal places to display. | |
| * @param {number} baseQuantity Number of bytes in a kilobyte. | |
| * @param {string[]} sizes The unites to use for each power of the baseQuantity. | |
| * @return {string} Formatted byte size. | |
| */ | |
| export const formatBytes = ( | |
| bytes, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function groupStrings(strings) { | |
| return Object.values(strings.sort().reduce((a, str) => { | |
| const s = str.toLowerCase(); | |
| const f = s[0]; | |
| a[f] = a[f] ? [...a[f], s] : [s]; | |
| return a; | |
| }, {})); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @mixin grid($cols, $rowGap: 0, $colGap: 0, $flexGrow: false) { | |
| display: flex; | |
| gap: #{$rowGap}px #{$colGap}px; | |
| flex-wrap: wrap; | |
| .col { | |
| flex-basis: calc((100% - #{$colGap}px * (#{$cols} - 1)) / #{$cols}); | |
| @if $flexGrow == true { | |
| flex-grow: 1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| if (typeof URL != 'function') { | |
| rewriteURL(); | |
| } else if (!('searchParams' in new URL(window.location))) { | |
| rewriteURL(); | |
| } | |
| function rewriteURL() { | |
| // Overwrite URL if no searchParams property exists. |
NewerOlder