diff options
| author | cvega <[email protected]> | 2016-10-03 01:06:54 -0700 |
|---|---|---|
| committer | cvega <[email protected]> | 2016-10-03 01:06:54 -0700 |
| commit | 96132d55ee2e867f9598926c86724fb86775e9ac (patch) | |
| tree | aa28ef0e798b69a2c97780bae3e2ebbf6dd61020 /lib | |
| parent | fc9d5351cd34d741538a364a31d22ae0c0f8101e (diff) | |
| download | faker-96132d55ee2e867f9598926c86724fb86775e9ac.tar.xz faker-96132d55ee2e867f9598926c86724fb86775e9ac.zip | |
[api] Add `filePath, directoryPath` system methods
* Returns a random path with file name
* Returns a random directory path (no trailing slash)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/locales/en/system/directoryPaths.js | 62 | ||||
| -rw-r--r-- | lib/locales/en/system/index.js | 3 | ||||
| -rw-r--r-- | lib/system.js | 11 |
3 files changed, 70 insertions, 6 deletions
diff --git a/lib/locales/en/system/directoryPaths.js b/lib/locales/en/system/directoryPaths.js new file mode 100644 index 00000000..509cd107 --- /dev/null +++ b/lib/locales/en/system/directoryPaths.js @@ -0,0 +1,62 @@ +module['exports'] = [ + "/Applications", + "/bin", + "/boot", + "/boot/defaults", + "/dev", + "/etc", + "/etc/defaults", + "/etc/mail", + "/etc/namedb", + "/etc/periodic", + "/etc/ppp", + "/home", + "/home/user", + "/home/user/dir", + "/lib", + "/Library", + "/lost+found", + "/media", + "/mnt", + "/net", + "/Network", + "/opt", + "/opt/bin", + "/opt/include", + "/opt/lib", + "/opt/sbin", + "/opt/share", + "/private", + "/private/tmp", + "/private/var", + "/proc", + "/rescue", + "/root", + "/sbin", + "/selinux", + "/srv", + "/sys", + "/System", + "/tmp", + "/Users", + "/usr", + "/usr/X11R6", + "/usr/bin", + "/usr/include", + "/usr/lib", + "/usr/libdata", + "/usr/libexec", + "/usr/local/bin", + "/usr/local/src", + "/usr/obj", + "/usr/ports", + "/usr/sbin", + "/usr/share", + "/usr/src", + "/var", + "/var/log", + "/var/mail", + "/var/spool", + "/var/tmp", + "/var/yp" +]; diff --git a/lib/locales/en/system/index.js b/lib/locales/en/system/index.js index 4dcd9955..f13c92d3 100644 --- a/lib/locales/en/system/index.js +++ b/lib/locales/en/system/index.js @@ -1,3 +1,4 @@ var system = {}; module['exports'] = system; -system.mimeTypes = require("./mimeTypes");
\ No newline at end of file +system.directoryPaths = require("./directoryPaths"); +system.mimeTypes = require("./mimeTypes"); diff --git a/lib/system.js b/lib/system.js index 60a55246..7b625518 100644 --- a/lib/system.js +++ b/lib/system.js @@ -125,21 +125,22 @@ function System (faker) { }; /** - * not yet implemented + * returns directory path * * @method faker.system.directoryPath */ this.directoryPath = function () { - // TODO + var paths = faker.definitions.system.directoryPaths + return faker.random.arrayElement(paths); }; /** - * not yet implemented + * returns file path * * @method faker.system.filePath */ this.filePath = function () { - // TODO + return faker.fake("{{system.directoryPath}}/{{system.fileName}}"); }; /** @@ -155,4 +156,4 @@ function System (faker) { } -module['exports'] = System;
\ No newline at end of file +module['exports'] = System; |
