Skip to content

Instantly share code, notes, and snippets.

@saginadir
Created February 17, 2017 18:16
Show Gist options
  • Save saginadir/f7051bbdc11b7fa59073dbd79648899a to your computer and use it in GitHub Desktop.
Save saginadir/f7051bbdc11b7fa59073dbd79648899a to your computer and use it in GitHub Desktop.
const capitalize = (string) =>
string.charAt(0).toUpperCase().concat(string.slice(1));
const saveToDb = (db, entity) =>
() =>
db.save(entity);
const html = (selector, newHtml) =>
() =>
$(selector).html(newHtml);
const executeAll = ()
function updateUserNameSaveToDb(user, newName, db) {
const newUser = {...user, name: capitalize(newName)}
const saveNewUserToDb = saveToDb(db, newUser);
const changeUserGreeting = html('.user-greet', `hello ${newUser.name}`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment