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
let memoize = fn => { | |
let cache = {}; | |
return (...args) => { | |
let stringifiedArgs = JSON.stringify(args); | |
let result = cache[stringifiedArgs] = cache[stringifiedArgs] || fn(...args); | |
return result; | |
}; | |
}; | |
let pureAdd = (x,y) => { return x + y }; // pure function |
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
*** | |
Empresa: TAM Numero do voo: 3001 DI: 0 Tipo: N Origem: SBEG Destino: SBKP | |
Saida prevista: 10/02/14 10:10:10 | |
Saida real: 10/02/14 10:10:10 | |
Chegada prevista: 10/02/14 13:11:00 | |
Chegada real: 10/02/14 13:11:00 | |
Situacao: Realizado Justificativa: -- | |
*** | |
*** | |
Empresa: GOL Numero do voo: 3098 DI: 0 Tipo: N Origem: SBCG Destino: SBBR |
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
const findByFieldRange = field => (list, range) => | |
list.filter(obj => obj[field] >= range[0] && obj[field] <= range[1]); | |
const getAllByField = field => list => list.filter(obj => obj[field]); | |
const findIn = list => ({ | |
by: field => ({ | |
between: (start, end = start) => | |
findByFieldRange(field)(list, [start, end]), | |
getAll: () => getAllByField(field)(list), |