brew install helm
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
// List | |
type List<A> = Nil | Cons<A>; | |
interface Nil { | |
readonly _tag: "Nil"; | |
} | |
interface Cons<A> { | |
readonly _tag: "Cons"; | |
readonly head: A; |
class Node { | |
constructor(value) { | |
this.value = value | |
this.next = null | |
this.prev = null | |
} | |
} | |
class DoubleLinkedList { | |
constructor(value) { |
class Node { | |
constructor(value) { | |
this.value = value | |
this.next = null | |
} | |
} | |
class LinkedList { | |
constructor(value) { | |
const newNode = new Node(value) |
const filterAsync = <T>(arr: T[], fn: (x: T) => Promise<boolean>) => | |
mapAsync(arr, fn).then((arr2) => arr.filter((_, i) => Boolean(arr2[i]))); | |
(async () => { | |
console.log("START FILTER"); | |
const filtered = await filterAsync([1, 2, 3, 4], async (n) => { | |
const x = await fakeFilter(n); | |
return x; | |
}); | |
useResult(filtered); |
const forEachAsync = <T>(arr: T[], fn: (x: T) => any): Promise<any> => | |
arr.reduce( | |
(promise: Promise<void>, value: T) => promise.then(() => fn(value)), | |
Promise.resolve() | |
); | |
(async () => { | |
console.log("START FOREACH VIA REDUCE"); | |
await forEachAsync([1, 2, 3, 4], async (n) => { | |
const x = await fakeAPI(n * 1000, n); |
const mapAsync = <T, R>(arr: T[], fn: (x: T) => Promise<R>) => | |
Promise.all(arr.map(fn)); | |
(async () => { | |
console.log("START MAP"); | |
const mapped = await mapAsync([1, 2, 3, 4], async (n) => { | |
const x = await fakeAPI(n * 1000, n); | |
return x * 10; | |
}); | |
useResult(mapped); |
const { ApolloServer, gql, SchemaDirectiveVisitor } = require('apollo-server'); | |
const { GraphQLScalarType, defaultFieldResolver, GraphQLString } = require('graphql'); | |
const { Kind } = require('graphql/language'); | |
const formatDate = require("dateformat"); | |
const typeDefs = gql` | |
directive @date( | |
defaultFormat: String = "mmmm d, yyyy" | |
) on FIELD_DEFINITION |