diff --git a/.changeset/bright-eggs-marry.md b/.changeset/bright-eggs-marry.md new file mode 100644 index 0000000..0a360cc --- /dev/null +++ b/.changeset/bright-eggs-marry.md @@ -0,0 +1,5 @@ +--- +'@lottiefiles/lottie-js': patch +--- + +**metadata**: set empty array for files with no keywords diff --git a/.changeset/poor-lizards-dance.md b/.changeset/poor-lizards-dance.md new file mode 100644 index 0000000..24142c7 --- /dev/null +++ b/.changeset/poor-lizards-dance.md @@ -0,0 +1,5 @@ +--- +'@lottiefiles/lottie-js': patch +--- + +**metadata**: do not use the default generator when a file does not have metadata diff --git a/src/animation/animation.ts b/src/animation/animation.ts index 2d935b8..b51a88b 100644 --- a/src/animation/animation.ts +++ b/src/animation/animation.ts @@ -354,6 +354,9 @@ export class Animation { if ('meta' in json) { this.meta.fromJSON(json.meta); + } else { + this.meta.fromJSON({}); + this.meta.generator = undefined; } if ('fonts' in json) { diff --git a/src/animation/meta.ts b/src/animation/meta.ts index 8955ef9..1bd975a 100644 --- a/src/animation/meta.ts +++ b/src/animation/meta.ts @@ -51,7 +51,7 @@ export class Meta { */ public fromJSON(json: Record): Meta { this.author = json.a; - this.keywords = 'k' in json ? json.k.split(',').map((w: string) => w.trim()) : [json.k]; + this.keywords = 'k' in json ? json.k.split(',').map((w: string) => w.trim()) : []; this.generator = json.g; this.description = json.d; this.themeColor = json.tc;