@soyguijarro
👨💻 Web engineer from Madrid
💼 Dev tools at Undefined Labs
🤩 JavaScript, React, Web APIs
🗣️ International tech speaker
🎓 Adalab bootcamp volunteer
💖 Community and inclusion
@soyguijarro
“
”
Christian Rudder, co-founder of OkCupid
“
”
Amarnath Thombre, chief of algorithms for Match.com
“
”
Jessica Carbino, Tinder's in-house dating and relationship expert
“
”
Tinder Experiments II
(async function() {
title('Swipr');
try {
let config = readConfig();
if (shouldRunSetup) {
config = await runSetup(config);
}
await runMain(config);
} catch (err) {
error(`Error: ${err.message}`);
}
})();
async function runMain(config) {
try {
// Do stuff
} catch (err) {
switch (err) {
case apiErrors.NO_MATCH_RECOMMENDATIONS:
throw Error('No match recommendations');
case apiErrors.OUT_OF_LIKES:
throw Error('You are out of likes');
default:
throw err;
}
}
}
const title = str => {
console.info(chalk.bold.magenta('❤️'), str);
};
const success = str => {
console.info(chalk.bold.green('✔️'), str);
};
const error = str => {
console.error(chalk.bold.red('❌'), str);
};
const readConfig = key => (getConfig())[key];
const writeConfig = (key, value) => {
setConfig({ ...getConfig(), [key]: value });
};
const isConfigValid = (key, value) => {
switch (key) {
case 'phoneNumber':
return Number.isInteger(value);
default:
return false;
}
};
async function createApi(refreshToken) {
return Object.keys(methods).reduce((api, method) => {
api[method] = async function(...args) {
const callMethod = () => methods[method](apiToken, ...args);
try {
return callMethod();
} catch (err) {
if (err.statusCode === UNAUTHORIZED_CODE) {
await refreshApiToken(refreshToken);
return callMethod();
}
throw err;
}
};
return api;
}, {});
}
async function likeUser(apiToken, userId) {
const response = await get('/like/' + userId, {
apiToken
});
if (!response.likes_remaining) {
throw errors.OUT_OF_LIKES;
}
return response;
}
“
”
Kari Paul, MarketWatch
@soyguijarro