stringAttr

Returns an attribute as a string, or the fallback when it is absent or anything else. The string is not trimmed.

@internote/canvas-sdkFunction
On this page
import { stringAttr } from '@internote/canvas-sdk';

#Signature

(
    attrs: Readonly<Record<string, unknown>>,
    identifier: string,
    fallback: string,
): string
(
    attrs: Readonly<Record<string, unknown>>,
    identifier: string,
): string | undefined

#Parameters

attrs
An attribute map, such as ctx.animation.attrValuesOf(node).
identifier
The attribute's canonical name.
fallback
What to return when the attribute is not a string.

Declared in packages/canvas-sdk/src/environment/node-attributes.ts:117.

Last updated