A collection of examples for typcial code smells taken from real world examples...
People
:bowtie: |
😄 :smile: |
😆 :laughing: |
---|---|---|
😊 :blush: |
😃 :smiley: |
:relaxed: |
😏 :smirk: |
😍 :heart_eyes: |
😘 :kissing_heart: |
😚 :kissing_closed_eyes: |
😳 :flushed: |
😌 :relieved: |
😆 :satisfied: |
😁 :grin: |
😉 :wink: |
😜 :stuck_out_tongue_winking_eye: |
😝 :stuck_out_tongue_closed_eyes: |
😀 :grinning: |
😗 :kissing: |
😙 :kissing_smiling_eyes: |
😛 :stuck_out_tongue: |
This file contains 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
import string_stream from 'string-to-stream' | |
import multi_stream from 'multistream' | |
ctx.status = 200 | |
ctx.body = multi_stream | |
([ | |
string_stream(before_content), | |
typeof content === 'string' ? string_stream(content) : content, | |
string_stream(after_content) | |
]) |
Functions can have properties, that's what the object literal syntax is for: it allows to define a call signature and additional properties. Your two examples are equivalent because the second doesn't define additional properties on the object literal. You can read more on that in the section on hybrid types.
Additionally, the object literal allows to define multiple call signatures for function overloads. You can create an object of such an interface with Object.assign:`
interface Foo {
(x: string): number,
(x: number): string,
bar: Array<any>,
SOurce: https://www.gulshansingh.com/posts/useful-bash-aliases/
# ls aliases
alias ls='ls --color'
alias ll='ls -lh --color'
alias la='ls -lA --color'