Skip to content

Instantly share code, notes, and snippets.

View chase-moskal's full-sized avatar
🌋
erupting with creativity

Chase Moskal chase-moskal

🌋
erupting with creativity
View GitHub Profile
@chase-moskal
chase-moskal / tree-node.ts
Last active October 8, 2022 01:22
typescript mappable tree node class
type Unpacked<T> =
T extends (infer U)[]
? U
: T extends (...args: any[]) => infer U
? U
: T extends Promise<infer U>
? U
: T
@chase-moskal
chase-moskal / promise-all-keys.ts
Last active July 22, 2024 09:12
Typescript function to await all promised object properties
type Unpacked<T> =
T extends (infer U)[]
? U
: T extends (...args: any[]) => infer U
? U
: T extends Promise<infer U>
? U
: T
@chase-moskal
chase-moskal / locale2.js
Last active August 20, 2019 21:57
quick es-module adaptation of npm module "locale2"
/*
code adapted from "locale2" v2.3.1
- https://www.npmjs.com/package/locale2
- https://github.com/moimikey/locale2
- adapted by Chase Moskal (@chase-moskal)
------
@chase-moskal
chase-moskal / darkvalley.ts
Created March 31, 2021 05:07
darkvalley typescript validation
export type Validator<xValue> = (value: xValue) => string[]
export function validator<xValue>(...conditions: Validator<xValue>[]): Validator<xValue> {
return value => {
const problems: string[] = []
for (const condition of conditions) {
for (const problem of condition(value))
problems.push(problem)
}
@chase-moskal
chase-moskal / package-lock.json
Created January 10, 2022 10:51
to reproduce an importly bug
{
"name": "nailcareer.com",
"version": "0.2.48",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "nailcareer.com",
"version": "0.2.48",
"license": "UNLICENSED",
❯ node -v
v20.6.0
❯ npm run build
> @benev/[email protected] build
> run-s clean compile permissions demo
> @benev/[email protected] clean
> rm -rf x && mkdir x