This file contains 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
package io.github.sauranbone.plang; | |
import org.apache.commons.lang3.StringUtils; | |
import java.util.regex.Pattern; | |
/** | |
* @author Vinzent Zeband | |
* @version 06:07 CET, 13.02.2022 | |
* @since 1.0 |
This file contains 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
package io.github.sauranbone.plang.core.abstraction; | |
import javax.annotation.Nonnull; | |
import javax.annotation.Nullable; | |
import java.util.Collection; | |
import java.util.Map; | |
import java.util.Set; | |
import java.util.function.Function; | |
/** |
This file contains 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
import {Query, QueryCache, QueryClient, QueryFilters} from "@tanstack/react-query"; | |
import {InfiniteData} from "@tanstack/query-core/build/lib/types"; | |
export type InfiniteQueryData<U, V> = InfiniteData<U | V | undefined>; | |
export type InfinitePageMapperParam<OldPageT, NewPageT> = { | |
page: OldPageT | NewPageT, | |
index: number, | |
param?: unknown, | |
query?: Query<unknown, unknown, InfiniteQueryData<OldPageT, NewPageT>>, |
This file contains 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
type EnumKey<EnumType> = keyof EnumType; | |
type IdentityEnum<T> = T extends Array<infer E extends string> ? { | |
readonly [P in T[keyof T] as E]: E | |
} : never; | |
type IdentityEnumConstructor = { | |
<T extends string[]>(...values: T): IdentityEnum<T>; | |
new <T extends string[]>(...values: T): IdentityEnum<T>; | |
}; |
This file contains 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
import formidable from 'formidable'; | |
import { IncomingMessage } from 'http'; | |
import { z, ZodObject, ZodType } from 'zod'; | |
export type KnownFormFields = Record<string, ZodType>; | |
export type FormParseResult<TFields, TFiles> = { | |
error?: Error; | |
fields?: TFields; | |
files?: TFiles; |
This file contains 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
export type Primitives = | |
| number | |
| string | |
| boolean | |
| bigint | |
| symbol | |
| undefined | |
| null; | |
export type DeepReadonly<TInput> = TInput extends Primitives | Function |
This file contains 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
import { RefObject, useEffect } from 'react'; | |
export default function useDetectEventOutside< | |
TNode extends Node, | |
TEventType extends keyof DocumentEventMap | |
>( | |
reference: RefObject<TNode>, | |
eventType: TEventType, | |
eventListener: (this: Document, ev: DocumentEventMap[TEventType]) => any | |
) { |
This file contains 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
/* | |
* Example: | |
* | |
* | |
*/ | |
const ExampleUnitMap = { xl: 3.0, md: 1.0, sm: 0.5, }; | |
type ExampleUnit = keyof typeof ExampleUnitMap; |
This file contains 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
// prettier-config-ignore | |
/** Typesafe alternative to Typescript's "Extract" type-utility */ | |
export type UnionExtract<TUnion, TKeys extends TUnion> = TUnion extends TKeys | |
? TUnion | |
: never; | |
// prettier-config-ignore | |
/** Typesafe alternative to Typescript's "Exclude" type-utility */ | |
export type UnionExclude<TUnion, TKeys extends TUnion> = TUnion extends TKeys | |
? never |
This file contains 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
/** @author Vinzent Zeband - you will need (./types imports) | |
* https://gist.github.com/zvint/a7fd6cdcb9054dd9b9d53164d0088e33 */ | |
import type { RecursiveRecord, SplitToTuple, SplitToUnion } from './types'; | |
// <==================================> | |
// MAIN OBJECT-PATH TYPES | |
// <==================================> | |
/** Non-specific property key that can be used to represent a path segment. */ | |
export type GenericPathSegment = string | number; |
OlderNewer