Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Javascript - Dependency between arguments of partial applications

const makeSendEmail = (subjectTemplate, bodyTemplate) => async (to, ...props) => {
    const mailsRef = firestore.collection("mails");
    const subject = subjectTemplate(...props);
    const html = bodyTemplate(...props);
    const mail = {…};
    …
};

//use

const sendUpdatePasswordEmail = makeSendEmail(
  (language) => t("subject.scope", language), 
  updatePasswordTemplate
);

//call

sendUpdatePasswordEmail(emailAddress, language);
 
PREVIOUS NEXT
Tagged: #Javascript #Dependency #arguments #partial #applications
ADD COMMENT
Topic
Name
9+5 =