Reference · Options, materials, stacks and wear
cardAttributesfunction
The attributes of a <fuda-card> for these options, ready to set one by one (element.setAttribute(name, value)): names are the
kebab-case of the option's, a true boolean is the empty string (the attribute is present) and a false one, like anything that
is undefined or null, is left out. Numbers are written as plain text.
Import it
import { cardAttributes } from "@johnmorrisdotca/fuda-cards";
Definition
function cardAttributes(options: CardOptions): Record<string, string>
Parameters
| Name | Type | Description |
|---|---|---|
options | CardOptions | The settings of the card, by their camel-case names. |
Returns
Record<string, string>
The attributes by name; set each with element.setAttribute(name, value). Nothing is shared with options.
Examples
import { cardAttributes } from "@johnmorrisdotca/fuda-cards";
console.log(cardAttributes({ title: "Explorer One", stackMessiness: 0.5, flipped: true, wear: undefined }));
// { title: 'Explorer One', 'stack-messiness': '0.5', flipped: '' }{ title: 'Explorer One', 'stack-messiness': '0.5', flipped: '' }What it prints (run when this page was built)