Skip to content

Instantly share code, notes, and snippets.

const validateJobRequest = (jobRequest) => {
const missing = [];
if (!jobRequest.industry) missing.push("industry");
if (!jobRequest.title) missing.push("title");
if (!jobRequest.email) missing.push("email");
if (!jobRequest.date) missing.push("date");
if (!jobRequest.location) missing.push("location");
if (missing.length > 1) {
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
type IsNumber<A extends string> = A extends `${Digit}${infer T}` ? T extends "" ? true : IsNumber<T> : false
type NaN = "NaN"
type ToLiteralNumber<T extends string> = IsNumber<T> extends true ? MkTuple<T> extends true[] ? MkTuple<T>['length'] : NaN : NaN
type MkTuple<N extends string | number, T extends true[] = []> = `${T['length']}` extends `${N}` ? T : MkTuple<N, [true, ...T]>
type Add<A extends number, B extends number> = [...MkTuple<A>, ...MkTuple<B>]['length']
@rjdestigter
rjdestigter / machine.js
Last active September 7, 2020 17:40
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@rjdestigter
rjdestigter / machine.js
Last active March 31, 2020 17:32
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@rjdestigter
rjdestigter / machine.js
Last active March 20, 2020 13:59
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@rjdestigter
rjdestigter / machine.js
Last active March 20, 2020 13:49
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
BMS
Home
routeToLogin -> Login
routeToSignUp -> SignUp
routeToHIW -> HowItWorks
routeToTC -> TermsAndConditions
routeToPP -> PrivacityPolicy
Login
clickUsername -> Username
@rjdestigter
rjdestigter / machine.js
Created March 12, 2020 00:05
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@rjdestigter
rjdestigter / machine.js
Created March 11, 2020 19:20
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions