Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use nullish coalescing assignment #1229

Merged
merged 2 commits into from May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion ecosystem/plugin-nprogress/src/client/nprogress.ts
Expand Up @@ -224,7 +224,7 @@ const css = (function () {

function getStyleProp(name: string): string {
name = camelCase(name)
return cssProps[name] || (cssProps[name] = getVendorProp(name))
return (cssProps[name] ??= getVendorProp(name))
}

function applyCss(element: HTMLElement, prop: string, value: string): void {
Expand Down
Expand Up @@ -40,8 +40,7 @@ export const importCodePlugin: PluginWithOptions<ImportCodePluginOptions> = (

// extract imported files to env
if (importFilePath) {
const importedFiles = env.importedFiles || (env.importedFiles = [])
importedFiles.push(importFilePath)
;(env.importedFiles ??= []).push(importFilePath)
}

// render the import_code token as a fence token
Expand Down
3 changes: 1 addition & 2 deletions packages/markdown/src/plugins/linksPlugin/linksPlugin.ts
Expand Up @@ -130,8 +130,7 @@ export const linksPlugin: PluginWithOptions<LinksPluginOptions> = (
hrefAttr[1] = `${normalizedPath}${rawHash}`

// extract internal links for file / page existence check
const links = env.links || (env.links = [])
links.push({
;(env.links ??= []).push({
raw: hrefLink,
relative: relativePath,
absolute: absolutePath,
Expand Down