Created
November 20, 2020 06:45
-
-
Save gaurangrshah/ac876987ba25906fbb86173287dce7ce to your computer and use it in GitHub Desktop.
#db #utils #js #seed #data
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
function seed (length, schema) { | |
return new Array(length) //create a new array with length(num) of 'undefined' values | |
.fill(1) // convert 'undefined' values to the number 1 | |
.map((_, i) => ({schema})) // map over the array length(num) of times and output an item based on schema | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment