JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1093
  • Score
    100M100P100Q118469F
  • License MIT

Composable functions to easily build last structures

Package Exports

  • @lottiefiles/last-builder
  • @lottiefiles/last-builder/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lottiefiles/last-builder) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

last-builder

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,
                },
                ],
            },
            ],
        },
        ],
    },
    ]
}

License © LottieFiles