1export function isStringNaN(value: string): boolean {
2 return window.isNaN(value as any) || Number.isNaN(parseInt(value)) || !(/^-?\d+$/.test(value));
5export function listStrings(list: string[], includeAnd: boolean = false): string {
6 if (includeAnd && list.length > 1) {
7 return listStrings(list.slice(0, -1)) + ' and ' + listStrings(list.slice(-1));
9 return "'" + list.join("', '") + "'";
12export function filterObject(obj, predicate) {
13 return Object.fromEntries(Object.entries(obj).filter(([key, value]) => predicate(key, value)));
16export function buildQuerystring(data) {
17 if (typeof (data) === 'string') return data;
20 for (let key in data) {
21 if (data.hasOwnProperty(key)) {
22 // Encode each key and value, concatenate them into a string, and push them to the array
23 query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
27 // Join each item in the array with a `&` and return the resulting string
28 return query.length ? '?' + query.join('&') : '';
31export function setStoreKey(store, key, value) {
32 store.update((store) => ({
38export function toggleStoreKey(store, key) {
39 store.update((store) => ({
45export function capitalize(string: string): string {
46 return string.charAt(0).toUpperCase() + string.slice(1);
49export function uxToHex(ux: string) {
51 if (ux.length > 2 && ux.substring(0, 2) === '0x') {
52 value = ux.substring(2)
55 value = value.replace('.', '').padStart(6, '0');
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list