Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

createEmptyCard

Create an empty card

@example
const card: Card = createEmptyCard(new Date());
@example
interface CardUnChecked
  extends Omit<Card, "due" | "last_review" | "state"> {
  cid: string;
  due: Date | number;
  last_review: Date | null | number;
  state: StateType;
}

function cardAfterHandler(card: Card) {
     return {
      ...card,
      cid: "test001",
      state: State[card.state],
      last_review: card.last_review ?? null,
    } as CardUnChecked;
}

const card: CardUnChecked = createEmptyCard(new Date(), cardAfterHandler);
function createEmptyCard<R = Card>(now?: DateInput, afterHandler?: (card: Card) => R): R;
§
createEmptyCard<R = Card>(now?: DateInput, afterHandler?: (card: Card) => R): R
[src]

§Type Parameters

§Parameters

§
now?: DateInput optional
[src]

Current time

§
afterHandler?: (card: Card) => R optional
[src]

Convert the result to another type. (Optional)

§Return Type