Omit undefined properties (#8582)

This commit is contained in:
LitoMore 2023-05-25 20:45:12 +08:00 committed by GitHub
parent d42c4a0883
commit e9c814ac00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -63,8 +63,10 @@ const build = async () => {
escape(icon.path),
escape(icon.source),
escape(icon.hex),
icon.guidelines ? `'${escape(icon.guidelines)}'` : undefined,
licenseToObject(icon.license),
icon.guidelines ? `\n guidelines: '${escape(icon.guidelines)}',` : '',
licenseToObject(icon.license)
? `\n license: ${JSON.stringify(licenseToObject(icon.license))},`
: '',
);
};
const writeJs = async (filepath, rawJavaScript, opts = null) => {

View file

@ -6,7 +6,5 @@
},
path: '%s',
source: '%s',
hex: '%s',
guidelines: %s,
license: %s,
hex: '%s',%s%s
}

4
types.d.ts vendored
View file

@ -25,6 +25,6 @@ export interface SimpleIcon {
path: string;
source: string;
hex: string;
guidelines: string | undefined;
license: License | undefined;
guidelines?: string;
license?: License;
}