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.path),
escape(icon.source), escape(icon.source),
escape(icon.hex), escape(icon.hex),
icon.guidelines ? `'${escape(icon.guidelines)}'` : undefined, icon.guidelines ? `\n guidelines: '${escape(icon.guidelines)}',` : '',
licenseToObject(icon.license), licenseToObject(icon.license)
? `\n license: ${JSON.stringify(licenseToObject(icon.license))},`
: '',
); );
}; };
const writeJs = async (filepath, rawJavaScript, opts = null) => { const writeJs = async (filepath, rawJavaScript, opts = null) => {

View file

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

4
types.d.ts vendored
View file

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