character-card-utils

Installing

npm install character-card-utils

Importing

ES6

import * as Cards from 'character-card-utils'

CommonJS

const Cards = require('character-card-utils')

Parsing/validating arbitrary JSON

Refer to the documentation for parseToV2 and safeParseToV2. Those functions automatically convert V1 cards to V2.

For more specific parsers, refer to the documentation for v1, v2, book, and entry.

Utilities

  • v1ToV2 converts a V1 card into a V2 card, populating V2-only fields with sensible defaults
  • backfillV2 makes a V2 card backward-compatible with V1-only frontends by backfilling V1 fields.
  • backfillV2WithObsolescenceNotice backfills every V1 fields with "This is a V2 Character Card. Please update your frontend."

Index

Helper functions

Typings

Zod parsers

Generated using TypeDoc