diff options
| author | Tobias Witt <[email protected]> | 2016-03-02 15:21:54 +0100 |
|---|---|---|
| committer | Marak <[email protected]> | 2016-03-03 04:30:38 -0500 |
| commit | 90a6a04f9cd4a134fec20949e68beb4baf79bfae (patch) | |
| tree | 70ada7191ace4c22e7d6a5ffa4a65a92d65c92a9 /lib/system.js | |
| parent | 9bb2b7c341bcf41e00341c92a8a66620c401c85f (diff) | |
| download | faker-90a6a04f9cd4a134fec20949e68beb4baf79bfae.tar.xz faker-90a6a04f9cd4a134fec20949e68beb4baf79bfae.zip | |
Install jsdoc and add doclet stubs for all methods
Descriptions are taken from existing comments if available. The address module already has some new sample descriptions.
Diffstat (limited to 'lib/system.js')
| -rw-r--r-- | lib/system.js | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/lib/system.js b/lib/system.js index 0ecb94bc..60a55246 100644 --- a/lib/system.js +++ b/lib/system.js @@ -1,8 +1,18 @@ // generates fake data for many computer systems properties +/** + * + * @namespace faker.system + */ function System (faker) { - // generates a file name with extension or optional type + /** + * generates a file name with extension or optional type + * + * @method faker.system.fileName + * @param {string} ext + * @param {string} type + */ this.fileName = function (ext, type) { var str = faker.fake("{{random.words}}.{{system.fileExt}}"); str = str.replace(/ /g, '_'); @@ -13,6 +23,13 @@ function System (faker) { return str; }; + /** + * commonFileName + * + * @method faker.system.commonFileName + * @param {string} ext + * @param {string} type + */ this.commonFileName = function (ext, type) { var str = faker.random.words() + "." + (ext || faker.system.commonFileExt()); str = str.replace(/ /g, '_'); @@ -23,17 +40,31 @@ function System (faker) { return str; }; + /** + * mimeType + * + * @method faker.system.mimeType + */ this.mimeType = function () { return faker.random.arrayElement(Object.keys(faker.definitions.system.mimeTypes)); }; - // returns a commonly used file type + /** + * returns a commonly used file type + * + * @method faker.system.commonFileType + */ this.commonFileType = function () { var types = ['video', 'audio', 'image', 'text', 'application']; return faker.random.arrayElement(types) }; - // returns a commonly used file extension based on optional type + /** + * returns a commonly used file extension based on optional type + * + * @method faker.system.commonFileExt + * @param {string} type + */ this.commonFileExt = function (type) { var types = [ 'application/pdf', @@ -50,7 +81,11 @@ function System (faker) { }; - // returns any file type available as mime-type + /** + * returns any file type available as mime-type + * + * @method faker.system.fileType + */ this.fileType = function () { var types = []; var mimes = faker.definitions.system.mimeTypes; @@ -63,6 +98,12 @@ function System (faker) { return faker.random.arrayElement(types); }; + /** + * fileExt + * + * @method faker.system.fileExt + * @param {string} mimeType + */ this.fileExt = function (mimeType) { var exts = []; var mimes = faker.definitions.system.mimeTypes; @@ -83,14 +124,29 @@ function System (faker) { return faker.random.arrayElement(exts); }; + /** + * not yet implemented + * + * @method faker.system.directoryPath + */ this.directoryPath = function () { // TODO }; + /** + * not yet implemented + * + * @method faker.system.filePath + */ this.filePath = function () { // TODO }; + /** + * semver + * + * @method faker.system.semver + */ this.semver = function () { return [faker.random.number(9), faker.random.number(9), |
