Created
August 31, 2022 16:11
-
-
Save hesan-aminiloo/f5d8d95ea6081833db20010bb22ce01a to your computer and use it in GitHub Desktop.
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
const withIntroAndDownload = (base = '') => `معرفی و دانلود ${base}`; | |
const withIntroAndPurchase = (base) => `معرفی، خرید و دانلود ${base}`; | |
const withFreeContent = (base) => `رایگان ${base}`; | |
const withBook = (base) => `کتاب ${base}`; | |
const withAudioBook = (base) => `کتاب صوتی ${base}`; | |
const withPodcast = (base) => `پادکست ${base}`; | |
const compose = (...fns) => (param) => | |
fns.reduceRight((y, f) => f(y), param); | |
console.log( | |
compose(withIntroAndPurchase, withBook)('ملت عشق') | |
); // معرفی، خرید و دانلود کتاب ملت عشق | |
console.log( | |
compose(withIntroAndDownload, withFreeContent, withBook)('ملت عشق') | |
); // معرفی و دانلود رایگان کتاب ملت عشق | |
console.log( | |
compose(withIntroAndDownload, withFreeContent, withAudioBook)('ملت عشق') | |
); // معرفی و دانلود رایگان کتاب صوتی ملت عشق |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment