@lottiefiles/last-builder
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

last-builder

npm npm bundle size npm npm

Use composable functions to build up a last structure

Use

yarn add @lottiefiles/last-builder
import { at, el, ob, pt, rt } from '@lottiefiles/last-builder';

const output = rt([
    at('v', 'version', pt('4.8.0')),
    el(
    'meta',
    'metadata',
    ob('custom', [
        at('a', 'author', pt('LottieFiles')),
        at('d', 'description', pt('A lottie animation.')),
        at('data', 'custom', pt(2)),
    ]),
    ),
]);

output will equal

{
    type: 'root',
    title: 'animation',
    hasExpressions: false,
    children: [
    {
        type: 'attribute',
        key: 'v',
        title: 'version',
        children: [
        {
            type: 'primitive',
            value: '4.8.0',
        },
        ],
    },
    {
        type: 'element',
        key: 'meta',
        title: 'metadata',
        children: [
        {
            type: 'object',
            title: 'custom',
            children: [
            {
                type: 'attribute',
                key: 'a',
                title: 'author',
                children: [
                {
                    type: 'primitive',
                    value: 'LottieFiles',
                },
                ],
            },
            {
                type: 'attribute',
                key: 'd',
                title: 'description',
                children: [
                {
                    type: 'primitive',
                    value: 'A lottie animation.',
                },
                ],
            },
            {
                type: 'attribute',
                key: 'data',
                title: 'custom',
                children: [
                {
                    type: 'primitive',
                    value: 2,
                },
                ],
            },
            ],
        },
        ],
    },
    ]
}

Legal

License © LottieFiles

Package Sidebar

Install

npm i @lottiefiles/last-builder

Weekly Downloads

11,434

Version

1.4.0

License

MIT

Unpacked Size

16 kB

Total Files

6

Last publish

Collaborators

  • aidosmf
  • jawish
  • karamalie
  • sam-osb