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
function pipe(...functions) { | |
return input => functions.reduce((value, func) => func(value), input); | |
} | |
function compose(...functions) { | |
return input => functions.reduceRight((value, func) => func(value), input); | |
} |
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
function createPage({ | |
title = '', // 해당 값이 없을 때 기본으로 사용할 값 | |
body = '', | |
tags = [], | |
actions = [], | |
} = {}) { /* ... */ } | |
// usage | |
createPage({ | |
title: 'Hello world!', |
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
function createPage(title, body, tags, actions) { /* ... */ } | |
// usage | |
createPage('Hello world!', 'bodybodybody', ['onboarding'], []); |
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
function createPage({ title, body, tags, actions }) { /* ... */ } | |
// usage | |
createPage({ | |
title: 'Hello world!', | |
body: 'bodybodybody', | |
tags: ['onboarding'], | |
actions: [], | |
}); |
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
async function sendNotifications() { | |
const preferences = await UserPreferencesRepository.findAll(); | |
preferences | |
.filter(isPreferenceHasAllowedNotification) | |
.forEach(NotificationModule.send); | |
} | |
function isPreferenceHasAllowedNotification(preference) { | |
return preference.hasAllowedNotification; |
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
async function sendNotifications() { | |
const preferences = await UserPreferencesRepository.findAll(); | |
preferences.forEach(preference => { | |
if (preference.hasAllowedNotification) { | |
NotificationModule.send(preference); | |
} | |
}); | |
} |
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
async function checkS10(deviceName) { | |
return deviceName.includes('Galaxy S10'); | |
} |
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
import DeviceInfo from 'react-native-device-info'; | |
async function checkS10() { | |
const deviceName = await DeviceInfo.getDeviceName(); | |
return deviceName.includes('S10'); | |
} |
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
_ _ _ | |
>(.)__ <(.)__ =(.)__ | |
(___/ (___/ (___/ |
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
function* infiniteValue(acc = 0) { | |
yield acc; | |
yield* infiniteValue(acc + 1); | |
} | |
const iter = infiniteValue(); | |
console.log(iter.next().value); // 0 | |
console.log(iter.next().value); // 1 | |
console.log(iter.next().value); // 2 | |
console.log(iter.next().value); // 3 |