Skip to main content

Function: toAsset()

toAsset(item, type, defaults): unknown

Defined in: src/lib/assets/schema.ts:226

An asset of version 1, whose header and content were side by side, as an asset of version 2 (see Asset). It gets its @type, and a name and author from defaults if it has none.

Parameters​

item​

unknown

type​

string

defaults​

AssetDefaults

Returns​

unknown

Example​

toAsset({ id: "…", name: "Sunset", colours: ["#ff7e07"] }, "PaintCanvas/ColourPalette",
{ name: "Untitled palette", author: "Unknown" });
// { "@type": "PaintCanvas/ColourPalette", id: "…", name: "Sunset", author: "Unknown", content: { colours: [...] } }