made with esnextbin
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
/** | |
* Adapted from https://github.com/broofa/mime/blob/main/index.js#L4 | |
*/ | |
export const mimeTypesToFileExtensions = { | |
"application/andrew-inset": ["ez"], | |
"application/applixware": ["aw"], | |
"application/atom+xml": ["atom"], | |
"application/atomcat+xml": ["atomcat"], | |
"application/atomsvc+xml": ["atomsvc"], | |
"application/bdoc": ["bdoc"], |
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 class WeakRefMap<K, V extends object> { | |
#weakRefs = new Map<K, WeakRef<V>>() | |
#registry = new FinalizationRegistry((key) => this.#weakRefs.delete(key)) | |
has = (key: K) => this.#weakRefs.has(key) | |
get = (key: K) => this.#weakRefs.get(key)?.deref() | |
set = (key: K, value: V) => { | |
const ref = new WeakRef(value) |
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 Subtract<A extends string, B extends string> = { | |
readonly [Key in A]: (Record<B, never> & Record<string, Key>)[Key] | |
}[A] | |
type Dissoc<A, B extends string> = Readonly<Pick<A, Subtract<keyof A, B>>> |
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 const enum KeyboareEventKey { | |
// Modifier Keys | |
Alt = 'Alt', | |
AltGraph = 'AltGraph', | |
CapsLock = 'CapsLock', | |
Control = 'Control', | |
Fn = 'Fn', | |
FnLock = 'FnLock', | |
Hyper = 'Hyper', | |
Meta = 'Meta', |
made with esnextbin
made with esnextbin
made with esnextbin
made with esnextbin
made with esnextbin
NewerOlder