Created
May 15, 2020 06:23
-
-
Save carmouche/1233b22e897959758641ce5acf0b85e1 to your computer and use it in GitHub Desktop.
Quickly mock array of objects with unique id using lodash
This file contains 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
import {times, random} from 'lodash'; | |
const mockContext = { | |
property: times(10, i => ({ | |
id: (i + 1).toString(), | |
// get randomized boolean values | |
isTruthy: !!random(0, 1) | |
})) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment