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
// | |
// main.swift | |
// nvim-reminders-xpc | |
// | |
// Created by . on 2/11/24. | |
// | |
import XPC | |
import EventKit |
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 CamelCaseKeys<T extends unknown> = { | |
[K in keyof T as CamelCaseKey<K>]: T[K] | |
} | |
type CamelCaseKey<T> = T extends `${infer T0}_${infer T1}` ? `${T0}${CamelCaseKeyN<T1>}` : T | |
type CamelCaseKeyN<T> = T extends `${infer T0}_${infer T1}` ? `${Sentence<T0>}${CamelCaseKeyN<T1>}` : Sentence<T> | |
type Sentence<T> = T extends `${infer T0}${infer T1}` ? `${Uppercase<T0>}${T1}` : 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
type UniqueParser0<T, R extends unknown[], M> = Readonly<T> extends readonly [] ? T : UniqueParser1<T, R, M> | |
type UniqueParser1<T, R extends unknown[], M> = Readonly<T> extends readonly [infer _] ? T : UniqueParserN<T, R, M> | |
type UniqueParserN<T, R extends unknown[], M> = Readonly<T> extends readonly [infer A, ...infer B] ? A extends M ? UniqueParserTerm<B, R, M> : UniqueParserTerm<B, [...R, A], M | A> : never | |
type UniqueParserTerm<T, R extends unknown[], M> = Readonly<T> extends readonly [] ? R : UniqueParserN<T, R, M> | |
export type UniqueTuple<T> = UniqueParser0<T, [], 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
module JSONParser | |
( JSONValue | |
, Parser(..) | |
, parseExact | |
, parseWhile | |
, separateBy | |
, jsonNull | |
, jsonBool | |
, jsonNumber | |
, jsonString |