Skip to content

Instantly share code, notes, and snippets.

@indongyoo
Last active April 3, 2018 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indongyoo/986b6cc224487f8b4e745b2b243bd65a to your computer and use it in GitHub Desktop.
Save indongyoo/986b6cc224487f8b4e745b2b243bd65a to your computer and use it in GitHub Desktop.
const { map, some } = Functional;
const f13 = pipe(
map(a => new Promise(function(resolve) {
resolve(a + 5);
})),
some(a => a > 10), // <- map에서 비동기를 제어한 후 some에 [10, 15, 20] 전달
console.log
).error(
e => console.log('err --->', e)
);
f13([5, 10, 15]); // true (정상 동작)
const f14 = pipe(
map(a => new Promise(function(resolve, reject) {
reject(`${a} reject!`); // 10, 15 는 실행되지 않습니다.
})),
some(a => a > 10), // <-- 여기에 오지 않습니다.
console.log // <-- 여기에 오지 않습니다.
).error(
e => console.log('err --->', e)
);
f14([5, 10, 15]); // err ---> 5 reject!
const f15 = pipe(
map(a => a + 5),
some(a => new Promise(function() {
Grrrr Kack Kack Bang Bang;
})),
console.log // <-- 여기에 오지 않습니다.
).error(
e => console.log('aya ~ ', e)
);
f15([5, 10, 15]); // aya ~ ReferenceError: Grrrr Kack Kack Bang Bang is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment