aboutsummaryrefslogtreecommitdiff
path: root/lib/image.js
diff options
context:
space:
mode:
authorRonen Babayoff <[email protected]>2015-08-23 21:57:46 -0400
committerRonen Babayoff <[email protected]>2015-08-23 21:57:46 -0400
commit66996e280c9fbbbc2e7db376549f568be32ad5cd (patch)
treee93f412c4bceeb7ed0376e26113c9d31522af8b4 /lib/image.js
parentcf0bd70d5fca9c0169414f5d2c16ca32431a3fd9 (diff)
parentd8f8108ac5dbec7e2b7ea9a23dd19aa42255e3fb (diff)
downloadfaker-66996e280c9fbbbc2e7db376549f568be32ad5cd.tar.xz
faker-66996e280c9fbbbc2e7db376549f568be32ad5cd.zip
Merge v3.0.1 into practicalmeteor:faker package branch
Diffstat (limited to 'lib/image.js')
-rw-r--r--lib/image.js75
1 files changed, 38 insertions, 37 deletions
diff --git a/lib/image.js b/lib/image.js
index aa983139..01f7f5cb 100644
--- a/lib/image.js
+++ b/lib/image.js
@@ -1,14 +1,15 @@
-var faker = require('../index');
+var Image = function (faker) {
-var image = {
- image: function () {
+ var self = this;
+
+ self.image = function () {
var categories = ["abstract", "animals", "business", "cats", "city", "food", "nightlife", "fashion", "people", "nature", "sports", "technics", "transport"];
- return image[faker.random.array_element(categories)]();
- },
- avatar: function () {
+ return self[faker.random.arrayElement(categories)]();
+ };
+ self.avatar = function () {
return faker.internet.avatar();
- },
- imageUrl: function (width, height, category) {
+ };
+ self.imageUrl = function (width, height, category) {
var width = width || 640;
var height = height || 480;
@@ -17,46 +18,46 @@ var image = {
url += '/' + category;
}
return url;
- },
- abstract: function (width, height) {
+ };
+ self.abstract = function (width, height) {
return faker.image.imageUrl(width, height, 'abstract');
- },
- animals: function (width, height) {
+ };
+ self.animals = function (width, height) {
return faker.image.imageUrl(width, height, 'animals');
- },
- business: function (width, height) {
+ };
+ self.business = function (width, height) {
return faker.image.imageUrl(width, height, 'business');
- },
- cats: function (width, height) {
+ };
+ self.cats = function (width, height) {
return faker.image.imageUrl(width, height, 'cats');
- },
- city: function (width, height) {
+ };
+ self.city = function (width, height) {
return faker.image.imageUrl(width, height, 'city');
- },
- food: function (width, height) {
+ };
+ self.food = function (width, height) {
return faker.image.imageUrl(width, height, 'food');
- },
- nightlife: function (width, height) {
+ };
+ self.nightlife = function (width, height) {
return faker.image.imageUrl(width, height, 'nightlife');
- },
- fashion: function (width, height) {
+ };
+ self.fashion = function (width, height) {
return faker.image.imageUrl(width, height, 'fashion');
- },
- people: function (width, height) {
+ };
+ self.people = function (width, height) {
return faker.image.imageUrl(width, height, 'people');
- },
- nature: function (width, height) {
+ };
+ self.nature = function (width, height) {
return faker.image.imageUrl(width, height, 'nature');
- },
- sports: function (width, height) {
+ };
+ self.sports = function (width, height) {
return faker.image.imageUrl(width, height, 'sports');
- },
- technics: function (width, height) {
+ };
+ self.technics = function (width, height) {
return faker.image.imageUrl(width, height, 'technics');
- },
- transport: function (width, height) {
+ };
+ self.transport = function (width, height) {
return faker.image.imageUrl(width, height, 'transport');
- }
-};
+ }
+}
-module.exports = image;
+module["exports"] = Image; \ No newline at end of file