Skip to content

Instantly share code, notes, and snippets.

View brunoskonrad's full-sized avatar
🃏

Bruno Konrad brunoskonrad

🃏
View GitHub Profile
@brunoskonrad
brunoskonrad / promised_samples.js
Created December 28, 2015 22:12
Funções de exemplos envoltas em promises
const Promised = {
getRandom(from, to) {
return new Promise((resolve) => {
getRandom(from, to, (value) => {
resolve(value);
});
});
},
sum(x, y) {
return new Promise((resolve) => {
function chain(value) {
var currentValue = value
return {
pipe(func, ...params) {
const input = [currentValue, ...params]
currentValue = func.apply(null, input)
return this
},