diff options
| author | Danielle Adams <[email protected]> | 2018-06-26 16:04:22 -0400 |
|---|---|---|
| committer | Marak <[email protected]> | 2018-09-23 11:12:09 -0400 |
| commit | 209aa3d254330ffa425c89157cc9f4ec749f3c3a (patch) | |
| tree | c30000b9f4504cb3c10b283fc6abb24c1cc3a6db /lib/git.js | |
| parent | 2968497cff29f81b223010c25fa7d34785a8a004 (diff) | |
| download | faker-209aa3d254330ffa425c89157cc9f4ec749f3c3a.tar.xz faker-209aa3d254330ffa425c89157cc9f4ec749f3c3a.zip | |
add git module to lib
Diffstat (limited to 'lib/git.js')
| -rw-r--r-- | lib/git.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/git.js b/lib/git.js new file mode 100644 index 00000000..4edb213a --- /dev/null +++ b/lib/git.js @@ -0,0 +1,63 @@ +/** + * @namespace faker.git + */ + +var Git = function(faker) { + var self = this; + var f = faker.fake; + + /** + * branch + * + * @method faker.git.branch + */ + self.branch = function() { + var noun = faker.hacker.noun().replace(' ', '-'); + var verb = faker.hacker.verb().replace(' ', '-'); + return 'noun' + '-' + 'verb'; + } + + /** + * commitSha + * + * @method faker.git.commitSha + */ + self.commitSha = function() { + var commit = ""; + + for (var i = 0; i < 40; i++) { + commit += faker.random.alphaNumeric(); + } + + return commit; + }; + + /** + * commitMessage + * + * @method faker.git.commitMessage + */ + self.commitMessage = function() { + var format = '{{hacker.verb}} {{hacker.adjective}} {{hacker.noun}}'; + return f(format); + }; + + /** + * shortSha + * + * @method faker.git.shortSha + */ + self.shortSha = function() { + var shortSha = ""; + + for (var i = 0; i < 7; i++) { + shortSha += faker.random.alphaNumeric(); + } + + return shortSha; + }; + + return self; +} + +module['exports'] = Git;
\ No newline at end of file |
