Created
June 9, 2021 18:00
-
-
Save willmendesneto/407c4076df3d98a04be95bf455a83172 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Link for example in Typescript playground | |
// https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABAcwKZQMIODZAKAWAChFTEJtcB+ALkQG9iznEBDAB3dVYCdXJUtRAGcoPGGGQBuJi1L8YAW1awEQ0eMkyScxABs4rACYTkAFVQAPKOrGntu8nHA26YEIoBGqHg91QAC1RFQTp6AG0AazoNUwBdOn4ATwBfRAAfRHc9PT9SFOIASjoANzgYIwZZUgowUQYOLl5+CFREAF5EAHI9CVQugBo2MCUVeCROrvYeOGQeVGFhQcRA4LbO7L0hg2NTC2sO7oAZQxNJADpL5YoXQ4BGNM7anGQMzPoU7WqnOrg9VHOBnwjW4fAEQwUylUYCGqxC21OeysUCGNzAUEK2gKRGIoEg0JQ6CwYBeACZCDoapRkEJGJSWCDmgJbJppN9mJCxmoYnYtOyyDszuZkSz7PyqS4hO4vD48iw4aEGFEeayEsNUhksiAcnLscVEGUKlV6bV6oywa1Ds9qOdzS02lQqN1emB+nLTVBhqMCU9qVRbSMoeNEI7utNZvNFl13Qh6gqrX7zvHQ5sY3VPYKkQdfSSbZnJPtPaGuiddhcrmn6mjPTmXv7qyGnXcvibY38AUC8HbwV6gwhYUF4fpEQXkajnOjMcRsbjwNBg2hMNSAMwU5jWmlhcVsTig+2ivn0jmBrlgA9so8CkfC6znuXrieuLUy3zbhW05UiXnINXJNKZVNvj1UpykqOkH3TBpdyZS1JhdfoIRPH0wxmOYFiWAc1kOTYETLG8a2Oa9LnOa5H3uR4fheRsGE+YhvlNdtAVmLtoItVBEO9cZMKHfN8PHFwpyIFIgA | |
function getConfig( | |
config?: { | |
appearance?: string; | |
animation?: string; | |
loadingText?: string; | |
count?: number; | |
theme?: {[k: string]: any} | null; | |
} | |
): void { | |
const {appearance = 'line', animation = 'progress', theme = null, loadingText = 'Loading...', count = 1} = config || {}; | |
console.log(appearance, animation, theme, loadingText, count); | |
} | |
function getConfig2( | |
config?: { | |
appearance?: string; | |
animation?: string; | |
loadingText?: string; | |
count?: number; | |
theme?: {[k: string]: any} | null; | |
} | |
): void { | |
const appearance = config?.appearance ?? 'line'; | |
const animation = config?.animation ?? 'progress'; | |
const theme = config?.theme ?? null; | |
const loadingText = config?.loadingText ?? 'Loading...'; | |
const count = config?.count ?? 1; | |
console.log(appearance, animation, theme, loadingText, count); | |
} | |
function getConfig3( | |
config?: { | |
appearance?: string; | |
animation?: string; | |
loadingText?: string; | |
count?: number; | |
theme?: {[k: string]: any} | null; | |
} | |
): void { | |
const {appearance = 'line', animation = 'progress', theme = null, loadingText = 'Loading...', count = 1} = config ?? {}; | |
console.log(appearance, animation, theme, loadingText, count); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment