Last active
December 26, 2018 01:59
-
-
Save Bestulo/5d8785bf84b8c9b8f78793d5d6ead9c1 to your computer and use it in GitHub Desktop.
Each line's first letter to uppercase (lines.split('\n').firstToUpper)
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
const { head, tail, toUpper } = require('ramda') | |
const text = `det var två ädla konungabarn | |
som lova varandra sin tro | |
och den som då skulle svika` | |
/* => | |
Det var två ädla konungabarn | |
Som lova varandra sin tro | |
Och den som då skulle svika | |
*/ | |
const verses = text.split('\n') | |
verses.map(verse => { | |
const vH = head(verse) | |
const vT = tail(verse) | |
return toUpper(vH) + vT | |
}).join('\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment