Last active
April 26, 2024 05:23
-
-
Save fitsum/2ebddcd049f479950d03b9c126b2075c to your computer and use it in GitHub Desktop.
svelte component
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
<script> | |
import Greet from "./Greet.svelte"; | |
let config4Pants = { | |
name: "Pants", | |
greeting: "What's up!" | |
}, | |
config4Son = { | |
name: "Son", | |
greeting: "Sup?" | |
} | |
</script> | |
<Greet /> | |
<Greet {...config4Pants} /> | |
<Greet name="Bro" greeting="Top of the morn to ya" /> | |
<Greet {...config4Son} /> |
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
<script> | |
let marks = "!?", | |
name = "homie", | |
greeting = "How's it hangin", | |
defaultMark = ".", | |
// FIXME: functionalize | |
mark = marks.split('').find(function(mark){ | |
var substr = greeting.substring(greeting.length - 1, greeting.length), | |
isMark = substr === mark; | |
if (isMark) { | |
return substr; | |
} | |
}) || defaultMark, | |
markSection = mark !== defaultMark ? greeting.slice(greeting[0], greeting.length - 1) : undefined, | |
rawGreeting = markSection || greeting; | |
export {name, greeting, rawGreeting, mark}; | |
</script> | |
<p> | |
{rawGreeting}, {name}{mark} | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment