You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
10 months ago | |
|---|---|---|
| src | 10 months ago | |
| test | 10 months ago | |
| typings/ramda | 10 months ago | |
| .gitignore | 10 months ago | |
| README.md | 10 months ago | |
| package-lock.json | 10 months ago | |
| package.json | 10 months ago | |
| tsconfig.json | 10 months ago | |
README.md
Swiss Army Knifey Ramda
Tools you could have gotten somewhere else, but you still decided to go this way.
Ramda Compose With Promise
Added typings to composeWithPromise
it('should await and return a composed result', async function() {
const paramToProp = (param: string) => ({ param });
const sleepingSentence = (s: number) => async ({ param }: { param: string }) => {
const d1 = new Date();
await sleep(s, TimeUnit.second);
const d2 = new Date();
return `a_[${param}], slept for: ${d2.getTime() - d1.getTime()}`;
};
const toUp = async (param: string) => param.toUpperCase();
const removeStart = async (param: string) => param.slice(1);
const composed = composeWithPromise(
removeStart,
sleepingSentence(1),
paramToProp,
toUp,
sleepingSentence(2),
paramToProp
);
return expect(composed('hey')).to.eventually.match(/_\[A_\[HEY\], SLEPT FOR: \d{4}\], slept for: \d{3,4}$/g);
});