Skip to the content

Fuda Cards札

Collectible card frames for images and live 3D: a true thickness, an edge, foil, stacks, wear and a binder, as two web components.

Fuda is the Japanese word 札 for a card or a tag. About the name

Contents

Reference · Collections and piles: pure helpers

parseCollectionfunction

Check a collection and make it the shape the element draws: an array of cards, or an object with a cards array. A card without an id is numbered by its place.

Import it

import { parseCollection } from "@johnmorrisdotca/fuda-cards/collection";

Definition

function parseCollection(input: unknown): CollectionCard[]

Parameters

NameTypeDescription
inputunknown

An array of items, or { cards: [...] } as an exported collection has it.

Returns

CollectionCard[]

A new array of cards; the input is not changed.

Examples

import { parseCollection } from "@johnmorrisdotca/fuda-cards/collection";

console.log(parseCollection([{ name: "Card", image: "front.jpg" }])); // [ { id: '0', name: 'Card', image: 'front.jpg' } ]
try {
  parseCollection([{ name: "Card" }]);
} catch (error) {
  console.log((error as Error).message); // Card 1 needs a name and image URL.
}
[ { id: '0', name: 'Card', image: 'front.jpg' } ]
Card 1 needs a name and image URL.

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/fuda-cards 0.11.0.