Last active
February 16, 2019 19:42
-
-
Save coffeepostal/2c5e8a03313bf6ce13b59c98bebe0081 to your computer and use it in GitHub Desktop.
JS: Using Faker and Lodash, Generate a JSON File of People
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
module.exports = function () { | |
var faker = require('faker'); | |
var _ = require('lodash'); | |
var numberOfRecords = 100; | |
return { | |
people: _.times(numberOfRecords, function (n) { | |
return { | |
id: n, | |
name: faker.name.findName(), | |
avatar: faker.internet.avatar() | |
} | |
}) | |
} | |
} |
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
module.exports = function () { | |
var faker = require('faker'); | |
var _ = require('lodash'); | |
return { | |
people: _.times(100, function (n) { | |
return { | |
id: n, | |
name: faker.name.findName(), | |
avatar: faker.internet.avatar() | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment