Created
April 5, 2018 09:22
-
-
Save indongyoo/31be7f5a33ea064deb3c4e8800039cd4 to your computer and use it in GitHub Desktop.
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
// 선택된 모든 상품 중 할인 금액이 있는 상품의 총 수량 - pipe 이용 | |
pdts.selected.dq = pipe( | |
filter(selected), | |
filter(discount), | |
_ => pdts.total(quantity, _)); | |
console.log( pdts.selected.dq(products) ); // 5 | |
// 선택된 모든 상품 중 할인 금액이 있는 상품의 총 수량 - pipe + and 이용 | |
pdts.selected.dq = pipe( | |
filter(and(selected, discount)), | |
_ => pdts.total(quantity, _)); | |
console.log( pdts.selected.dq(products) ); // 5 | |
// 선택된 모든 상품 중 할인 금액이 없는 상품의 기본 금액 x 수량 뽑기 | |
go(products, | |
filter(selected), | |
reject(discount), | |
pdts.price, | |
console.log); // 40000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment