Skip to content

Commit

Permalink
various
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Bergman authored and Matthew Bergman committed May 15, 2010
1 parent e1d1c86 commit 8e5f08a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 38 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var Faker = {};
Faker.Name = require('./lib/name');
Faker.Address = require('./lib/address');
Faker.PhoneNumber = require('./lib/phone_number');
Faker.Internet = require('./lib/internet');


var Helper = require('helper');;

Expand All @@ -19,6 +21,7 @@ sys.puts(JSON.stringify(Faker.Address.streetName()));
sys.puts(JSON.stringify(Faker.Address.streetAddress()));
sys.puts(JSON.stringify(Faker.Address.streetAddress(true)));
sys.puts(JSON.stringify(Faker.PhoneNumber.phoneNumber()));
sys.puts(JSON.stringify(Faker.Internet.userName()));



41 changes: 3 additions & 38 deletions lib/internet.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,6 @@ exports.email = function() {

};

export.userName = function(name) {
if( typeof name == 'undefined'){ var name = false;}
if(name) {
name
}

}
def email(name = nil)
[ user_name(name), domain_name ].join('@')
end

def free_email(name = nil)
[ user_name(name), %w(gmail.com yahoo.com hotmail.com).rand ].join('@')
end

def user_name(name = nil)
return name.scan(/\w+/).shuffle.join(%w(. _).rand).downcase if name

[
Proc.new { Name.first_name.gsub(/\W/, '').downcase },
Proc.new {
[ Name.first_name, Name.last_name ].map {|n|
n.gsub(/\W/, '')
}.join(%w(. _).rand).downcase }
].rand.call
end

def domain_name
[ domain_word, domain_suffix ].join('.')
end

def domain_word
Company.name.split(' ').first.gsub(/\W/, '').downcase
end

def domain_suffix
%w(co.uk com us uk ca biz info name).rand
end
exports.userName = function() {

};

0 comments on commit 8e5f08a

Please sign in to comment.