Created
March 5, 2019 16:10
-
-
Save ianfabs/48584d32d302e093d7d86dae5d60e703 to your computer and use it in GitHub Desktop.
A collection of lovely one-liners that I use
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
// A sleep implementation in javascript | |
const sleep = t => new Promise(r=>setTimeout(r,t)); | |
// A function that rearranges an object returned by mongoose to play nicely with graphql resolvers | |
const objectify = o => (o.isArray()?o.map(e=>objectify(e)):({...o.toObject(),_id:o._id.toString()})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment