From 9424f3e6a851a0bcf6e8420a654bf33d6c0bae64 Mon Sep 17 00:00:00 2001 From: Marak Date: Sat, 13 Sep 2014 20:29:32 +0200 Subject: [PATCH] [dist] Rebuild --- Readme.md | 2 +- build/build/faker.js | 109 +++++++++++++++++++++++++++++++++++---- build/build/faker.min.js | 6 +-- examples/js/faker.js | 109 +++++++++++++++++++++++++++++++++++---- examples/js/faker.min.js | 6 +-- 5 files changed, 203 insertions(+), 29 deletions(-) diff --git a/Readme.md b/Readme.md index 275058de7..066469075 100644 --- a/Readme.md +++ b/Readme.md @@ -25,7 +25,7 @@ ## API - + ## Tests npm install . diff --git a/build/build/faker.js b/build/build/faker.js index 5e1c7f184..426905827 100644 --- a/build/build/faker.js +++ b/build/build/faker.js @@ -30,8 +30,9 @@ exports.Tree = require('./lib/tree'); exports.Date = require('./lib/date'); exports.random = require('./lib/random'); exports.definitions = require('./lib/definitions'); +exports.Finance = require('./lib/finance'); -},{"./lib/address":2,"./lib/company":3,"./lib/date":4,"./lib/definitions":5,"./lib/helpers":6,"./lib/image":7,"./lib/internet":8,"./lib/lorem":9,"./lib/name":10,"./lib/phone_number":11,"./lib/random":12,"./lib/tree":13}],2:[function(require,module,exports){ +},{"./lib/address":2,"./lib/company":3,"./lib/date":4,"./lib/definitions":5,"./lib/finance":6,"./lib/helpers":7,"./lib/image":8,"./lib/internet":9,"./lib/lorem":10,"./lib/name":11,"./lib/phone_number":12,"./lib/random":13,"./lib/tree":14}],2:[function(require,module,exports){ var Helpers = require('./helpers'); var faker = require('../index'); var definitions = require('../lib/definitions'); @@ -133,7 +134,7 @@ var address = { module.exports = address; -},{"../index":1,"../lib/definitions":5,"./helpers":6}],3:[function(require,module,exports){ +},{"../index":1,"../lib/definitions":5,"./helpers":7}],3:[function(require,module,exports){ var faker = require('../index'); var company = { @@ -1624,7 +1625,81 @@ for (var i = 0; i < avatarUri.length; i++) { exports.avatar_uri.push("https://s3.amazonaws.com/uifaces/faces/twitter/" + avatarUri[i]); }; +exports.account_type = ["Checking","Savings","Money Market", "Investment", "Home Loan", "Credit Card", "Auto Loan", "Personal Loan"]; + +exports.transaction_type = ["deposit", "withdrawal", "payment", "invoice"]; },{}],6:[function(require,module,exports){ +var Helpers = require('./helpers'); +var definitions = require('./definitions'); + +var finance = { + + account: function (length) { + + length = length || 8; + + var template = ''; + + for (var i = 0; i < length; i++) { + template = template + '#'; + } + length = null; + return Helpers.replaceSymbolWithNumber(template); + }, + + accountName: function () { + + return [Helpers.randomize(definitions.account_type), 'Account'].join(' '); + }, + + mask: function (length, parens, elipsis) { + + + //set defaults + length = (length == 0 || !length || typeof length == 'undefined') ? 4 : length; + parens = (parens === null) ? true : parens; + elipsis = (elipsis === null) ? true : elipsis; + + //create a template for length + var template = ''; + + for (var i = 0; i < length; i++) { + template = template + '#'; + } + + //prefix with elipsis + template = (elipsis) ? ['...', template].join('') : template; + + template = (parens) ? ['(', template, ')'].join('') : template; + + //generate random numbers + template = Helpers.replaceSymbolWithNumber(template); + + return template; + + }, + + //min and max take in minimum and maximum amounts, dec is the decimal place you want rounded to, symbol is $, €, £, etc + //NOTE: this returns a string representation of the value, if you want a number use parseFloat and no symbol + + amount: function (min, max, dec, symbol) { + + min = min || 0; + max = max || 1000; + dec = dec || 2; + symbol = symbol || ''; + + return symbol + (Math.round((Math.random() * (max - min) + min) * Math.pow(10, dec)) / Math.pow(10, dec)).toFixed(dec); + + }, + + transactionType: function () { + return Helpers.randomize(definitions.transaction_type); + } +}; + +module.exports = finance; +},{"./definitions":5,"./helpers":7}],7:[function(require,module,exports){ var faker = require('../index'); // backword-compatibility @@ -1711,7 +1786,8 @@ exports.createCard = function () { "sentences": faker.Lorem.sentences(), "paragraph": faker.Lorem.paragraph() } - ] + ], + "accountHistory": [faker.Helpers.createTransaction(), faker.Helpers.createTransaction(), faker.Helpers.createTransaction()] }; }; @@ -1741,6 +1817,16 @@ exports.userCard = function () { }; }; +exports.createTransaction = function(){ + return { + "amount" : faker.Finance.amount(), + "date" : new Date(2012, 1, 2), //TODO: add a ranged date method + "business": faker.Company.companyName(), + "name": [faker.Finance.accountName(), faker.Finance.mask()].join(' '), + "type" : exports.randomize(faker.definitions.transaction_type), + "account" : faker.Finance.account() + }; +}; /* String.prototype.capitalize = function () { //v1.0 @@ -1750,7 +1836,8 @@ String.prototype.capitalize = function () { //v1.0 }; */ -},{"../index":1}],7:[function(require,module,exports){ + +},{"../index":1}],8:[function(require,module,exports){ var faker = require('../index'); var image = { @@ -1810,7 +1897,7 @@ var image = { module.exports = image; -},{"../index":1}],8:[function(require,module,exports){ +},{"../index":1}],9:[function(require,module,exports){ var faker = require('../index'); var internet = { @@ -1865,7 +1952,7 @@ var internet = { module.exports = internet; -},{"../index":1}],9:[function(require,module,exports){ +},{"../index":1}],10:[function(require,module,exports){ var faker = require('../index'); var Helpers = require('./helpers'); var definitions = require('../lib/definitions'); @@ -1912,7 +1999,7 @@ var lorem = { module.exports = lorem; -},{"../index":1,"../lib/definitions":5,"./helpers":6}],10:[function(require,module,exports){ +},{"../index":1,"../lib/definitions":5,"./helpers":7}],11:[function(require,module,exports){ var faker = require('../index'); var _name = { @@ -1948,7 +2035,7 @@ var _name = { module.exports = _name; -},{"../index":1}],11:[function(require,module,exports){ +},{"../index":1}],12:[function(require,module,exports){ var faker = require('../index'); var Helpers = require('./helpers'); var definitions = require('./definitions'); @@ -1971,7 +2058,7 @@ var phone = { module.exports = phone; -},{"../index":1,"./definitions":5,"./helpers":6}],12:[function(require,module,exports){ +},{"../index":1,"./definitions":5,"./helpers":7}],13:[function(require,module,exports){ var definitions = require('./definitions'); var mersenne = require('../vendor/mersenne'); var faker = require('../index'); @@ -2112,7 +2199,7 @@ var random = { module.exports = random; -},{"../index":1,"../vendor/mersenne":14,"./definitions":5}],13:[function(require,module,exports){ +},{"../index":1,"../vendor/mersenne":15,"./definitions":5}],14:[function(require,module,exports){ var faker = require('../index'); var tree = { @@ -2183,7 +2270,7 @@ var tree = { module.exports = tree; -},{"../index":1}],14:[function(require,module,exports){ +},{"../index":1}],15:[function(require,module,exports){ // this program is a JavaScript version of Mersenne Twister, with concealment and encapsulation in class, // an almost straight conversion from the original program, mt19937ar.c, // translated by y. okada on July 17, 2006. diff --git a/build/build/faker.min.js b/build/build/faker.min.js index e42599e7e..9119a2040 100644 --- a/build/build/faker.min.js +++ b/build/build/faker.min.js @@ -1,3 +1,3 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var a;"undefined"!=typeof window?a=window:"undefined"!=typeof global?a=global:"undefined"!=typeof self&&(a=self),a.faker=e()}}(function(){var define,module,exports;return function e(a,n,r){function i(t,l){if(!n[t]){if(!a[t]){var s="function"==typeof require&&require;if(!l&&s)return s(t,!0);if(o)return o(t,!0);var g=new Error("Cannot find module '"+t+"'");throw g.code="MODULE_NOT_FOUND",g}var p=n[t]={exports:{}};a[t][0].call(p.exports,function(e){var n=a[t][1][e];return i(n?n:e)},p,p.exports,e,a,n,r)}return n[t].exports}for(var o="function"==typeof require&&require,t=0;tr;r++)a[r]=e();return a.join(".")},color:function(e){var a=Math.floor((n.random.number(256)+e)/2),r=Math.floor((n.random.number(256)+e)/2),i=Math.floor((n.random.number(256)+e)/2);return"#"+a.toString(16)+r.toString(16)+i.toString(16)}};a.exports=r},{"../index":1}],9:[function(e,a){var n=e("../index"),r=e("./helpers"),i=e("../lib/definitions"),o={words:function(e){return"undefined"==typeof e&&(e=3),r.shuffle(i.lorem).slice(0,e)},sentence:function(e,a){return"undefined"==typeof e&&(e=3),"undefined"==typeof a&&(a=7),n.Lorem.words(e+n.random.number(a)).join(" ")},sentences:function(e){"undefined"==typeof e&&(e=3);var a=[];for(e;e>0;e--)a.push(n.Lorem.sentence());return a.join("\n")},paragraph:function(e){return"undefined"==typeof e&&(e=3),n.Lorem.sentences(e+n.random.number(3))},paragraphs:function(e){"undefined"==typeof e&&(e=3);var a=[];for(e;e>0;e--)a.push(n.Lorem.paragraph());return a.join("\n \r ")}};a.exports=o},{"../index":1,"../lib/definitions":5,"./helpers":6}],10:[function(e,a){var n=e("../index"),r={firstName:function(){return n.random.first_name()},firstNameFemale:function(){return n.random.first_name()},firstNameMale:function(){return n.random.first_name()},lastName:function(){return n.random.last_name()},findName:function(){var e=n.random.number(8);switch(e){case 0:return n.random.name_prefix()+" "+n.Name.firstName()+" "+n.Name.lastName();case 1:return n.Name.firstName()+" "+n.Name.lastName()+" "+n.random.name_suffix()}return n.Name.firstName()+" "+n.Name.lastName()}};a.exports=r},{"../index":1}],11:[function(e,a){var n=e("../index"),r=e("./helpers"),i=e("./definitions"),o={phoneNumber:function(){return r.replaceSymbolWithNumber(n.random.phone_formats())},phoneNumberFormat:function(e){return r.replaceSymbolWithNumber(i.phone_formats[e])},phoneCode:function(){return n.random.phone_codes()}};a.exports=o},{"../index":1,"./definitions":5,"./helpers":6}],12:[function(e,a){var n=e("./definitions"),r=e("../vendor/mersenne"),i=e("../index"),o={number:function(e){if("number"==typeof e)var e={max:e};e=e||{min:0,max:1,precision:1},"undefined"==typeof e.min&&(e.min=0),"undefined"==typeof e.max&&(e.max=1),e.max>0&&e.max++; -var a=r.rand(e.max,e.min);return a},array_element:function(e){var a=i.random.number({max:e.length-1});return e[a]},city_prefix:function(){return i.random.array_element(n.city_prefix)},city_suffix:function(){return i.random.array_element(n.city_suffix)},street_suffix:function(){return i.random.array_element(n.street_suffix)},br_state:function(){return i.random.array_element(n.br_state)},br_state_abbr:function(){return i.random.array_element(n.br_state_abbr)},us_state:function(){return i.random.array_element(n.us_state)},us_state_abbr:function(){return i.random.array_element(n.us_state_abbr)},uk_county:function(){return i.random.array_element(n.uk_county)},uk_country:function(){return i.random.array_element(n.uk_country)},first_name:function(){return i.random.array_element(n.first_name)},last_name:function(){return i.random.array_element(n.last_name)},name_prefix:function(){return i.random.array_element(n.name_prefix)},name_suffix:function(){return i.random.array_element(n.name_suffix)},catch_phrase_adjective:function(){return i.random.array_element(n.catch_phrase_adjective)},catch_phrase_descriptor:function(){return i.random.array_element(n.catch_phrase_descriptor)},catch_phrase_noun:function(){return i.random.array_element(n.catch_phrase_noun)},bs_adjective:function(){return i.random.array_element(n.bs_adjective)},bs_buzz:function(){return i.random.array_element(n.bs_buzz)},bs_noun:function(){return i.random.array_element(n.bs_noun)},phone_formats:function(){return i.random.array_element(n.phone_formats)},phone_codes:function(){return i.random.array_element(n.phone_codes)},domain_suffix:function(){return i.random.array_element(n.domain_suffix)},avatar_uri:function(){return i.random.array_element(n.avatar_uri)}};a.exports=o},{"../index":1,"../vendor/mersenne":14,"./definitions":5}],13:[function(require,module,exports){var faker=require("../index"),tree={clone:function(e){if(null==e||"object"!=typeof e)return e;var a=e.constructor();for(var n in e)a[n]=this.clone(e[n]);return a},createTree:function(depth,width,obj){if(!obj)throw{name:"ObjectError",message:"there needs to be an object passed in"};if(0>=width)throw{name:"TreeParamError",message:"width must be greater than zero"};var newObj=this.clone(obj);for(var prop in newObj)if(newObj.hasOwnProperty(prop)){var value=null;if("__RECURSE__"!==newObj[prop])value=eval(newObj[prop]);else if(0!==depth){value=[];var evalWidth=1;evalWidth="function"==typeof width?width():width;for(var i=0;evalWidth>i;i++)value.push(this.createTree(depth-1,width,obj))}newObj[prop]=value}return newObj}};module.exports=tree},{"../index":1}],14:[function(e,a,n){function r(){function e(e){return 0>e?(e^l)+l:e}function a(a,n){return n>a?e(4294967296-(n-a)&4294967295):a-n}function n(a,n){return e(a+n&4294967295)}function r(a,r){for(var i=0,o=0;32>o;++o)a>>>o&1&&(i=n(i,e(r<p;p++)g[p]=n(r(1812433253,e(g[p-1]^g[p-1]>>>30)),p),g[p]=e(4294967295&g[p])},this.init_by_array=function(o,t){var l,s,p;for(this.init_genrand(19650218),l=1,s=0,p=i>t?i:t;p;p--)g[l]=n(n(e(g[l]^r(e(g[l-1]^g[l-1]>>>30),1664525)),o[s]),s),g[l]=e(4294967295&g[l]),l++,s++,l>=i&&(g[0]=g[i-1],l=1),s>=t&&(s=0);for(p=i-1;p;p--)g[l]=a(e((dbg=g[l])^r(e(g[l-1]^g[l-1]>>>30),1566083941)),l),g[l]=e(4294967295&g[l]),l++,l>=i&&(g[0]=g[i-1],l=1);g[0]=2147483648};var d=[0,t];this.genrand_int32=function(){var a;if(p>=i){var n;for(p==i+1&&this.init_genrand(5489),n=0;i-o>n;n++)a=e(g[n]&l|g[n+1]&s),g[n]=e(g[n+o]^a>>>1^d[1&a]);for(;i-1>n;n++)a=e(g[n]&l|g[n+1]&s),g[n]=e(g[n+(o-i)]^a>>>1^d[1&a]);a=e(g[i-1]&l|g[0]&s),g[i-1]=e(g[o-1]^a>>>1^d[1&a]),p=0}return a=g[p++],a=e(a^a>>>11),a=e(a^a<<7&2636928640),a=e(a^a<<15&4022730752),a=e(a^a>>>18)},this.genrand_int31=function(){return this.genrand_int32()>>>1},this.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)},this.genrand_real2=function(){return this.genrand_int32()*(1/4294967296)},this.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)},this.genrand_res53=function(){var e=this.genrand_int32()>>>5,a=this.genrand_int32()>>>6;return(67108864*e+a)*(1/9007199254740992)}}n.MersenneTwister19937=r;var i=new r;i.init_genrand((new Date).getTime()%1e9),n.rand=function(e,a){return e||(a=0,e=32768),Math.floor(i.genrand_real2()*(e-a)+a)},n.seed=function(e){if("number"!=typeof e)throw new Error("seed(S) must take numeric argument; is "+typeof e);i.init_genrand(e)},n.seed_array=function(e){if("object"!=typeof e)throw new Error("seed_array(A) must take array of numbers; is "+typeof e);i.init_by_array(e)}},{}]},{},[1])(1)}); \ No newline at end of file +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var a;"undefined"!=typeof window?a=window:"undefined"!=typeof global?a=global:"undefined"!=typeof self&&(a=self),a.faker=e()}}(function(){var define,module,exports;return function e(a,n,r){function i(t,l){if(!n[t]){if(!a[t]){var s="function"==typeof require&&require;if(!l&&s)return s(t,!0);if(o)return o(t,!0);var g=new Error("Cannot find module '"+t+"'");throw g.code="MODULE_NOT_FOUND",g}var p=n[t]={exports:{}};a[t][0].call(p.exports,function(e){var n=a[t][1][e];return i(n?n:e)},p,p.exports,e,a,n,r)}return n[t].exports}for(var o="function"==typeof require&&require,t=0;tr;r++)a+="#";return e=null,n.replaceSymbolWithNumber(a)},accountName:function(){return[n.randomize(r.account_type),"Account"].join(" ")},mask:function(e,a,r){e=0!=e&&e&&"undefined"!=typeof e?e:4,a=null===a?!0:a,r=null===r?!0:r;for(var i="",o=0;e>o;o++)i+="#";return i=r?["...",i].join(""):i,i=a?["(",i,")"].join(""):i,i=n.replaceSymbolWithNumber(i)},amount:function(e,a,n,r){return e=e||0,a=a||1e3,n=n||2,r=r||"",r+(Math.round((Math.random()*(a-e)+e)*Math.pow(10,n))/Math.pow(10,n)).toFixed(n)},transactionType:function(){return n.randomize(r.transaction_type)}};a.exports=i},{"./definitions":5,"./helpers":7}],7:[function(e,a,n){var r=e("../index");n.randomNumber=function(e){return r.random.number(e)},n.randomize=function(e){return r.random.array_element(e)},n.slugify=function(e){return e.replace(/ /g,"-").replace(/[^\w\.\-]+/g,"")},n.replaceSymbolWithNumber=function(e,a){void 0===a&&(a="#");for(var n="",i=0;ir;r++)a[r]=e();return a.join(".")},color:function(e){var a=Math.floor((n.random.number(256)+e)/2),r=Math.floor((n.random.number(256)+e)/2),i=Math.floor((n.random.number(256)+e)/2);return"#"+a.toString(16)+r.toString(16)+i.toString(16)}};a.exports=r},{"../index":1}],10:[function(e,a){var n=e("../index"),r=e("./helpers"),i=e("../lib/definitions"),o={words:function(e){return"undefined"==typeof e&&(e=3),r.shuffle(i.lorem).slice(0,e)},sentence:function(e,a){return"undefined"==typeof e&&(e=3),"undefined"==typeof a&&(a=7),n.Lorem.words(e+n.random.number(a)).join(" ")},sentences:function(e){"undefined"==typeof e&&(e=3);var a=[];for(e;e>0;e--)a.push(n.Lorem.sentence());return a.join("\n")},paragraph:function(e){return"undefined"==typeof e&&(e=3),n.Lorem.sentences(e+n.random.number(3))},paragraphs:function(e){"undefined"==typeof e&&(e=3);var a=[];for(e;e>0;e--)a.push(n.Lorem.paragraph()); +return a.join("\n \r ")}};a.exports=o},{"../index":1,"../lib/definitions":5,"./helpers":7}],11:[function(e,a){var n=e("../index"),r={firstName:function(){return n.random.first_name()},firstNameFemale:function(){return n.random.first_name()},firstNameMale:function(){return n.random.first_name()},lastName:function(){return n.random.last_name()},findName:function(){var e=n.random.number(8);switch(e){case 0:return n.random.name_prefix()+" "+n.Name.firstName()+" "+n.Name.lastName();case 1:return n.Name.firstName()+" "+n.Name.lastName()+" "+n.random.name_suffix()}return n.Name.firstName()+" "+n.Name.lastName()}};a.exports=r},{"../index":1}],12:[function(e,a){var n=e("../index"),r=e("./helpers"),i=e("./definitions"),o={phoneNumber:function(){return r.replaceSymbolWithNumber(n.random.phone_formats())},phoneNumberFormat:function(e){return r.replaceSymbolWithNumber(i.phone_formats[e])},phoneCode:function(){return n.random.phone_codes()}};a.exports=o},{"../index":1,"./definitions":5,"./helpers":7}],13:[function(e,a){var n=e("./definitions"),r=e("../vendor/mersenne"),i=e("../index"),o={number:function(e){if("number"==typeof e)var e={max:e};e=e||{min:0,max:1,precision:1},"undefined"==typeof e.min&&(e.min=0),"undefined"==typeof e.max&&(e.max=1),e.max>0&&e.max++;var a=r.rand(e.max,e.min);return a},array_element:function(e){var a=i.random.number({max:e.length-1});return e[a]},city_prefix:function(){return i.random.array_element(n.city_prefix)},city_suffix:function(){return i.random.array_element(n.city_suffix)},street_suffix:function(){return i.random.array_element(n.street_suffix)},br_state:function(){return i.random.array_element(n.br_state)},br_state_abbr:function(){return i.random.array_element(n.br_state_abbr)},us_state:function(){return i.random.array_element(n.us_state)},us_state_abbr:function(){return i.random.array_element(n.us_state_abbr)},uk_county:function(){return i.random.array_element(n.uk_county)},uk_country:function(){return i.random.array_element(n.uk_country)},first_name:function(){return i.random.array_element(n.first_name)},last_name:function(){return i.random.array_element(n.last_name)},name_prefix:function(){return i.random.array_element(n.name_prefix)},name_suffix:function(){return i.random.array_element(n.name_suffix)},catch_phrase_adjective:function(){return i.random.array_element(n.catch_phrase_adjective)},catch_phrase_descriptor:function(){return i.random.array_element(n.catch_phrase_descriptor)},catch_phrase_noun:function(){return i.random.array_element(n.catch_phrase_noun)},bs_adjective:function(){return i.random.array_element(n.bs_adjective)},bs_buzz:function(){return i.random.array_element(n.bs_buzz)},bs_noun:function(){return i.random.array_element(n.bs_noun)},phone_formats:function(){return i.random.array_element(n.phone_formats)},phone_codes:function(){return i.random.array_element(n.phone_codes)},domain_suffix:function(){return i.random.array_element(n.domain_suffix)},avatar_uri:function(){return i.random.array_element(n.avatar_uri)}};a.exports=o},{"../index":1,"../vendor/mersenne":15,"./definitions":5}],14:[function(require,module,exports){var faker=require("../index"),tree={clone:function(e){if(null==e||"object"!=typeof e)return e;var a=e.constructor();for(var n in e)a[n]=this.clone(e[n]);return a},createTree:function(depth,width,obj){if(!obj)throw{name:"ObjectError",message:"there needs to be an object passed in"};if(0>=width)throw{name:"TreeParamError",message:"width must be greater than zero"};var newObj=this.clone(obj);for(var prop in newObj)if(newObj.hasOwnProperty(prop)){var value=null;if("__RECURSE__"!==newObj[prop])value=eval(newObj[prop]);else if(0!==depth){value=[];var evalWidth=1;evalWidth="function"==typeof width?width():width;for(var i=0;evalWidth>i;i++)value.push(this.createTree(depth-1,width,obj))}newObj[prop]=value}return newObj}};module.exports=tree},{"../index":1}],15:[function(e,a,n){function r(){function e(e){return 0>e?(e^l)+l:e}function a(a,n){return n>a?e(4294967296-(n-a)&4294967295):a-n}function n(a,n){return e(a+n&4294967295)}function r(a,r){for(var i=0,o=0;32>o;++o)a>>>o&1&&(i=n(i,e(r<p;p++)g[p]=n(r(1812433253,e(g[p-1]^g[p-1]>>>30)),p),g[p]=e(4294967295&g[p])},this.init_by_array=function(o,t){var l,s,p;for(this.init_genrand(19650218),l=1,s=0,p=i>t?i:t;p;p--)g[l]=n(n(e(g[l]^r(e(g[l-1]^g[l-1]>>>30),1664525)),o[s]),s),g[l]=e(4294967295&g[l]),l++,s++,l>=i&&(g[0]=g[i-1],l=1),s>=t&&(s=0);for(p=i-1;p;p--)g[l]=a(e((dbg=g[l])^r(e(g[l-1]^g[l-1]>>>30),1566083941)),l),g[l]=e(4294967295&g[l]),l++,l>=i&&(g[0]=g[i-1],l=1);g[0]=2147483648};var d=[0,t];this.genrand_int32=function(){var a;if(p>=i){var n;for(p==i+1&&this.init_genrand(5489),n=0;i-o>n;n++)a=e(g[n]&l|g[n+1]&s),g[n]=e(g[n+o]^a>>>1^d[1&a]);for(;i-1>n;n++)a=e(g[n]&l|g[n+1]&s),g[n]=e(g[n+(o-i)]^a>>>1^d[1&a]);a=e(g[i-1]&l|g[0]&s),g[i-1]=e(g[o-1]^a>>>1^d[1&a]),p=0}return a=g[p++],a=e(a^a>>>11),a=e(a^a<<7&2636928640),a=e(a^a<<15&4022730752),a=e(a^a>>>18)},this.genrand_int31=function(){return this.genrand_int32()>>>1},this.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)},this.genrand_real2=function(){return this.genrand_int32()*(1/4294967296)},this.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)},this.genrand_res53=function(){var e=this.genrand_int32()>>>5,a=this.genrand_int32()>>>6;return(67108864*e+a)*(1/9007199254740992)}}n.MersenneTwister19937=r;var i=new r;i.init_genrand((new Date).getTime()%1e9),n.rand=function(e,a){return e||(a=0,e=32768),Math.floor(i.genrand_real2()*(e-a)+a)},n.seed=function(e){if("number"!=typeof e)throw new Error("seed(S) must take numeric argument; is "+typeof e);i.init_genrand(e)},n.seed_array=function(e){if("object"!=typeof e)throw new Error("seed_array(A) must take array of numbers; is "+typeof e);i.init_by_array(e)}},{}]},{},[1])(1)}); \ No newline at end of file diff --git a/examples/js/faker.js b/examples/js/faker.js index 5e1c7f184..426905827 100644 --- a/examples/js/faker.js +++ b/examples/js/faker.js @@ -30,8 +30,9 @@ exports.Tree = require('./lib/tree'); exports.Date = require('./lib/date'); exports.random = require('./lib/random'); exports.definitions = require('./lib/definitions'); +exports.Finance = require('./lib/finance'); -},{"./lib/address":2,"./lib/company":3,"./lib/date":4,"./lib/definitions":5,"./lib/helpers":6,"./lib/image":7,"./lib/internet":8,"./lib/lorem":9,"./lib/name":10,"./lib/phone_number":11,"./lib/random":12,"./lib/tree":13}],2:[function(require,module,exports){ +},{"./lib/address":2,"./lib/company":3,"./lib/date":4,"./lib/definitions":5,"./lib/finance":6,"./lib/helpers":7,"./lib/image":8,"./lib/internet":9,"./lib/lorem":10,"./lib/name":11,"./lib/phone_number":12,"./lib/random":13,"./lib/tree":14}],2:[function(require,module,exports){ var Helpers = require('./helpers'); var faker = require('../index'); var definitions = require('../lib/definitions'); @@ -133,7 +134,7 @@ var address = { module.exports = address; -},{"../index":1,"../lib/definitions":5,"./helpers":6}],3:[function(require,module,exports){ +},{"../index":1,"../lib/definitions":5,"./helpers":7}],3:[function(require,module,exports){ var faker = require('../index'); var company = { @@ -1624,7 +1625,81 @@ for (var i = 0; i < avatarUri.length; i++) { exports.avatar_uri.push("https://s3.amazonaws.com/uifaces/faces/twitter/" + avatarUri[i]); }; +exports.account_type = ["Checking","Savings","Money Market", "Investment", "Home Loan", "Credit Card", "Auto Loan", "Personal Loan"]; + +exports.transaction_type = ["deposit", "withdrawal", "payment", "invoice"]; },{}],6:[function(require,module,exports){ +var Helpers = require('./helpers'); +var definitions = require('./definitions'); + +var finance = { + + account: function (length) { + + length = length || 8; + + var template = ''; + + for (var i = 0; i < length; i++) { + template = template + '#'; + } + length = null; + return Helpers.replaceSymbolWithNumber(template); + }, + + accountName: function () { + + return [Helpers.randomize(definitions.account_type), 'Account'].join(' '); + }, + + mask: function (length, parens, elipsis) { + + + //set defaults + length = (length == 0 || !length || typeof length == 'undefined') ? 4 : length; + parens = (parens === null) ? true : parens; + elipsis = (elipsis === null) ? true : elipsis; + + //create a template for length + var template = ''; + + for (var i = 0; i < length; i++) { + template = template + '#'; + } + + //prefix with elipsis + template = (elipsis) ? ['...', template].join('') : template; + + template = (parens) ? ['(', template, ')'].join('') : template; + + //generate random numbers + template = Helpers.replaceSymbolWithNumber(template); + + return template; + + }, + + //min and max take in minimum and maximum amounts, dec is the decimal place you want rounded to, symbol is $, €, £, etc + //NOTE: this returns a string representation of the value, if you want a number use parseFloat and no symbol + + amount: function (min, max, dec, symbol) { + + min = min || 0; + max = max || 1000; + dec = dec || 2; + symbol = symbol || ''; + + return symbol + (Math.round((Math.random() * (max - min) + min) * Math.pow(10, dec)) / Math.pow(10, dec)).toFixed(dec); + + }, + + transactionType: function () { + return Helpers.randomize(definitions.transaction_type); + } +}; + +module.exports = finance; +},{"./definitions":5,"./helpers":7}],7:[function(require,module,exports){ var faker = require('../index'); // backword-compatibility @@ -1711,7 +1786,8 @@ exports.createCard = function () { "sentences": faker.Lorem.sentences(), "paragraph": faker.Lorem.paragraph() } - ] + ], + "accountHistory": [faker.Helpers.createTransaction(), faker.Helpers.createTransaction(), faker.Helpers.createTransaction()] }; }; @@ -1741,6 +1817,16 @@ exports.userCard = function () { }; }; +exports.createTransaction = function(){ + return { + "amount" : faker.Finance.amount(), + "date" : new Date(2012, 1, 2), //TODO: add a ranged date method + "business": faker.Company.companyName(), + "name": [faker.Finance.accountName(), faker.Finance.mask()].join(' '), + "type" : exports.randomize(faker.definitions.transaction_type), + "account" : faker.Finance.account() + }; +}; /* String.prototype.capitalize = function () { //v1.0 @@ -1750,7 +1836,8 @@ String.prototype.capitalize = function () { //v1.0 }; */ -},{"../index":1}],7:[function(require,module,exports){ + +},{"../index":1}],8:[function(require,module,exports){ var faker = require('../index'); var image = { @@ -1810,7 +1897,7 @@ var image = { module.exports = image; -},{"../index":1}],8:[function(require,module,exports){ +},{"../index":1}],9:[function(require,module,exports){ var faker = require('../index'); var internet = { @@ -1865,7 +1952,7 @@ var internet = { module.exports = internet; -},{"../index":1}],9:[function(require,module,exports){ +},{"../index":1}],10:[function(require,module,exports){ var faker = require('../index'); var Helpers = require('./helpers'); var definitions = require('../lib/definitions'); @@ -1912,7 +1999,7 @@ var lorem = { module.exports = lorem; -},{"../index":1,"../lib/definitions":5,"./helpers":6}],10:[function(require,module,exports){ +},{"../index":1,"../lib/definitions":5,"./helpers":7}],11:[function(require,module,exports){ var faker = require('../index'); var _name = { @@ -1948,7 +2035,7 @@ var _name = { module.exports = _name; -},{"../index":1}],11:[function(require,module,exports){ +},{"../index":1}],12:[function(require,module,exports){ var faker = require('../index'); var Helpers = require('./helpers'); var definitions = require('./definitions'); @@ -1971,7 +2058,7 @@ var phone = { module.exports = phone; -},{"../index":1,"./definitions":5,"./helpers":6}],12:[function(require,module,exports){ +},{"../index":1,"./definitions":5,"./helpers":7}],13:[function(require,module,exports){ var definitions = require('./definitions'); var mersenne = require('../vendor/mersenne'); var faker = require('../index'); @@ -2112,7 +2199,7 @@ var random = { module.exports = random; -},{"../index":1,"../vendor/mersenne":14,"./definitions":5}],13:[function(require,module,exports){ +},{"../index":1,"../vendor/mersenne":15,"./definitions":5}],14:[function(require,module,exports){ var faker = require('../index'); var tree = { @@ -2183,7 +2270,7 @@ var tree = { module.exports = tree; -},{"../index":1}],14:[function(require,module,exports){ +},{"../index":1}],15:[function(require,module,exports){ // this program is a JavaScript version of Mersenne Twister, with concealment and encapsulation in class, // an almost straight conversion from the original program, mt19937ar.c, // translated by y. okada on July 17, 2006. diff --git a/examples/js/faker.min.js b/examples/js/faker.min.js index e42599e7e..9119a2040 100644 --- a/examples/js/faker.min.js +++ b/examples/js/faker.min.js @@ -1,3 +1,3 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var a;"undefined"!=typeof window?a=window:"undefined"!=typeof global?a=global:"undefined"!=typeof self&&(a=self),a.faker=e()}}(function(){var define,module,exports;return function e(a,n,r){function i(t,l){if(!n[t]){if(!a[t]){var s="function"==typeof require&&require;if(!l&&s)return s(t,!0);if(o)return o(t,!0);var g=new Error("Cannot find module '"+t+"'");throw g.code="MODULE_NOT_FOUND",g}var p=n[t]={exports:{}};a[t][0].call(p.exports,function(e){var n=a[t][1][e];return i(n?n:e)},p,p.exports,e,a,n,r)}return n[t].exports}for(var o="function"==typeof require&&require,t=0;tr;r++)a[r]=e();return a.join(".")},color:function(e){var a=Math.floor((n.random.number(256)+e)/2),r=Math.floor((n.random.number(256)+e)/2),i=Math.floor((n.random.number(256)+e)/2);return"#"+a.toString(16)+r.toString(16)+i.toString(16)}};a.exports=r},{"../index":1}],9:[function(e,a){var n=e("../index"),r=e("./helpers"),i=e("../lib/definitions"),o={words:function(e){return"undefined"==typeof e&&(e=3),r.shuffle(i.lorem).slice(0,e)},sentence:function(e,a){return"undefined"==typeof e&&(e=3),"undefined"==typeof a&&(a=7),n.Lorem.words(e+n.random.number(a)).join(" ")},sentences:function(e){"undefined"==typeof e&&(e=3);var a=[];for(e;e>0;e--)a.push(n.Lorem.sentence());return a.join("\n")},paragraph:function(e){return"undefined"==typeof e&&(e=3),n.Lorem.sentences(e+n.random.number(3))},paragraphs:function(e){"undefined"==typeof e&&(e=3);var a=[];for(e;e>0;e--)a.push(n.Lorem.paragraph());return a.join("\n \r ")}};a.exports=o},{"../index":1,"../lib/definitions":5,"./helpers":6}],10:[function(e,a){var n=e("../index"),r={firstName:function(){return n.random.first_name()},firstNameFemale:function(){return n.random.first_name()},firstNameMale:function(){return n.random.first_name()},lastName:function(){return n.random.last_name()},findName:function(){var e=n.random.number(8);switch(e){case 0:return n.random.name_prefix()+" "+n.Name.firstName()+" "+n.Name.lastName();case 1:return n.Name.firstName()+" "+n.Name.lastName()+" "+n.random.name_suffix()}return n.Name.firstName()+" "+n.Name.lastName()}};a.exports=r},{"../index":1}],11:[function(e,a){var n=e("../index"),r=e("./helpers"),i=e("./definitions"),o={phoneNumber:function(){return r.replaceSymbolWithNumber(n.random.phone_formats())},phoneNumberFormat:function(e){return r.replaceSymbolWithNumber(i.phone_formats[e])},phoneCode:function(){return n.random.phone_codes()}};a.exports=o},{"../index":1,"./definitions":5,"./helpers":6}],12:[function(e,a){var n=e("./definitions"),r=e("../vendor/mersenne"),i=e("../index"),o={number:function(e){if("number"==typeof e)var e={max:e};e=e||{min:0,max:1,precision:1},"undefined"==typeof e.min&&(e.min=0),"undefined"==typeof e.max&&(e.max=1),e.max>0&&e.max++; -var a=r.rand(e.max,e.min);return a},array_element:function(e){var a=i.random.number({max:e.length-1});return e[a]},city_prefix:function(){return i.random.array_element(n.city_prefix)},city_suffix:function(){return i.random.array_element(n.city_suffix)},street_suffix:function(){return i.random.array_element(n.street_suffix)},br_state:function(){return i.random.array_element(n.br_state)},br_state_abbr:function(){return i.random.array_element(n.br_state_abbr)},us_state:function(){return i.random.array_element(n.us_state)},us_state_abbr:function(){return i.random.array_element(n.us_state_abbr)},uk_county:function(){return i.random.array_element(n.uk_county)},uk_country:function(){return i.random.array_element(n.uk_country)},first_name:function(){return i.random.array_element(n.first_name)},last_name:function(){return i.random.array_element(n.last_name)},name_prefix:function(){return i.random.array_element(n.name_prefix)},name_suffix:function(){return i.random.array_element(n.name_suffix)},catch_phrase_adjective:function(){return i.random.array_element(n.catch_phrase_adjective)},catch_phrase_descriptor:function(){return i.random.array_element(n.catch_phrase_descriptor)},catch_phrase_noun:function(){return i.random.array_element(n.catch_phrase_noun)},bs_adjective:function(){return i.random.array_element(n.bs_adjective)},bs_buzz:function(){return i.random.array_element(n.bs_buzz)},bs_noun:function(){return i.random.array_element(n.bs_noun)},phone_formats:function(){return i.random.array_element(n.phone_formats)},phone_codes:function(){return i.random.array_element(n.phone_codes)},domain_suffix:function(){return i.random.array_element(n.domain_suffix)},avatar_uri:function(){return i.random.array_element(n.avatar_uri)}};a.exports=o},{"../index":1,"../vendor/mersenne":14,"./definitions":5}],13:[function(require,module,exports){var faker=require("../index"),tree={clone:function(e){if(null==e||"object"!=typeof e)return e;var a=e.constructor();for(var n in e)a[n]=this.clone(e[n]);return a},createTree:function(depth,width,obj){if(!obj)throw{name:"ObjectError",message:"there needs to be an object passed in"};if(0>=width)throw{name:"TreeParamError",message:"width must be greater than zero"};var newObj=this.clone(obj);for(var prop in newObj)if(newObj.hasOwnProperty(prop)){var value=null;if("__RECURSE__"!==newObj[prop])value=eval(newObj[prop]);else if(0!==depth){value=[];var evalWidth=1;evalWidth="function"==typeof width?width():width;for(var i=0;evalWidth>i;i++)value.push(this.createTree(depth-1,width,obj))}newObj[prop]=value}return newObj}};module.exports=tree},{"../index":1}],14:[function(e,a,n){function r(){function e(e){return 0>e?(e^l)+l:e}function a(a,n){return n>a?e(4294967296-(n-a)&4294967295):a-n}function n(a,n){return e(a+n&4294967295)}function r(a,r){for(var i=0,o=0;32>o;++o)a>>>o&1&&(i=n(i,e(r<p;p++)g[p]=n(r(1812433253,e(g[p-1]^g[p-1]>>>30)),p),g[p]=e(4294967295&g[p])},this.init_by_array=function(o,t){var l,s,p;for(this.init_genrand(19650218),l=1,s=0,p=i>t?i:t;p;p--)g[l]=n(n(e(g[l]^r(e(g[l-1]^g[l-1]>>>30),1664525)),o[s]),s),g[l]=e(4294967295&g[l]),l++,s++,l>=i&&(g[0]=g[i-1],l=1),s>=t&&(s=0);for(p=i-1;p;p--)g[l]=a(e((dbg=g[l])^r(e(g[l-1]^g[l-1]>>>30),1566083941)),l),g[l]=e(4294967295&g[l]),l++,l>=i&&(g[0]=g[i-1],l=1);g[0]=2147483648};var d=[0,t];this.genrand_int32=function(){var a;if(p>=i){var n;for(p==i+1&&this.init_genrand(5489),n=0;i-o>n;n++)a=e(g[n]&l|g[n+1]&s),g[n]=e(g[n+o]^a>>>1^d[1&a]);for(;i-1>n;n++)a=e(g[n]&l|g[n+1]&s),g[n]=e(g[n+(o-i)]^a>>>1^d[1&a]);a=e(g[i-1]&l|g[0]&s),g[i-1]=e(g[o-1]^a>>>1^d[1&a]),p=0}return a=g[p++],a=e(a^a>>>11),a=e(a^a<<7&2636928640),a=e(a^a<<15&4022730752),a=e(a^a>>>18)},this.genrand_int31=function(){return this.genrand_int32()>>>1},this.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)},this.genrand_real2=function(){return this.genrand_int32()*(1/4294967296)},this.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)},this.genrand_res53=function(){var e=this.genrand_int32()>>>5,a=this.genrand_int32()>>>6;return(67108864*e+a)*(1/9007199254740992)}}n.MersenneTwister19937=r;var i=new r;i.init_genrand((new Date).getTime()%1e9),n.rand=function(e,a){return e||(a=0,e=32768),Math.floor(i.genrand_real2()*(e-a)+a)},n.seed=function(e){if("number"!=typeof e)throw new Error("seed(S) must take numeric argument; is "+typeof e);i.init_genrand(e)},n.seed_array=function(e){if("object"!=typeof e)throw new Error("seed_array(A) must take array of numbers; is "+typeof e);i.init_by_array(e)}},{}]},{},[1])(1)}); \ No newline at end of file +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var a;"undefined"!=typeof window?a=window:"undefined"!=typeof global?a=global:"undefined"!=typeof self&&(a=self),a.faker=e()}}(function(){var define,module,exports;return function e(a,n,r){function i(t,l){if(!n[t]){if(!a[t]){var s="function"==typeof require&&require;if(!l&&s)return s(t,!0);if(o)return o(t,!0);var g=new Error("Cannot find module '"+t+"'");throw g.code="MODULE_NOT_FOUND",g}var p=n[t]={exports:{}};a[t][0].call(p.exports,function(e){var n=a[t][1][e];return i(n?n:e)},p,p.exports,e,a,n,r)}return n[t].exports}for(var o="function"==typeof require&&require,t=0;tr;r++)a+="#";return e=null,n.replaceSymbolWithNumber(a)},accountName:function(){return[n.randomize(r.account_type),"Account"].join(" ")},mask:function(e,a,r){e=0!=e&&e&&"undefined"!=typeof e?e:4,a=null===a?!0:a,r=null===r?!0:r;for(var i="",o=0;e>o;o++)i+="#";return i=r?["...",i].join(""):i,i=a?["(",i,")"].join(""):i,i=n.replaceSymbolWithNumber(i)},amount:function(e,a,n,r){return e=e||0,a=a||1e3,n=n||2,r=r||"",r+(Math.round((Math.random()*(a-e)+e)*Math.pow(10,n))/Math.pow(10,n)).toFixed(n)},transactionType:function(){return n.randomize(r.transaction_type)}};a.exports=i},{"./definitions":5,"./helpers":7}],7:[function(e,a,n){var r=e("../index");n.randomNumber=function(e){return r.random.number(e)},n.randomize=function(e){return r.random.array_element(e)},n.slugify=function(e){return e.replace(/ /g,"-").replace(/[^\w\.\-]+/g,"")},n.replaceSymbolWithNumber=function(e,a){void 0===a&&(a="#");for(var n="",i=0;ir;r++)a[r]=e();return a.join(".")},color:function(e){var a=Math.floor((n.random.number(256)+e)/2),r=Math.floor((n.random.number(256)+e)/2),i=Math.floor((n.random.number(256)+e)/2);return"#"+a.toString(16)+r.toString(16)+i.toString(16)}};a.exports=r},{"../index":1}],10:[function(e,a){var n=e("../index"),r=e("./helpers"),i=e("../lib/definitions"),o={words:function(e){return"undefined"==typeof e&&(e=3),r.shuffle(i.lorem).slice(0,e)},sentence:function(e,a){return"undefined"==typeof e&&(e=3),"undefined"==typeof a&&(a=7),n.Lorem.words(e+n.random.number(a)).join(" ")},sentences:function(e){"undefined"==typeof e&&(e=3);var a=[];for(e;e>0;e--)a.push(n.Lorem.sentence());return a.join("\n")},paragraph:function(e){return"undefined"==typeof e&&(e=3),n.Lorem.sentences(e+n.random.number(3))},paragraphs:function(e){"undefined"==typeof e&&(e=3);var a=[];for(e;e>0;e--)a.push(n.Lorem.paragraph()); +return a.join("\n \r ")}};a.exports=o},{"../index":1,"../lib/definitions":5,"./helpers":7}],11:[function(e,a){var n=e("../index"),r={firstName:function(){return n.random.first_name()},firstNameFemale:function(){return n.random.first_name()},firstNameMale:function(){return n.random.first_name()},lastName:function(){return n.random.last_name()},findName:function(){var e=n.random.number(8);switch(e){case 0:return n.random.name_prefix()+" "+n.Name.firstName()+" "+n.Name.lastName();case 1:return n.Name.firstName()+" "+n.Name.lastName()+" "+n.random.name_suffix()}return n.Name.firstName()+" "+n.Name.lastName()}};a.exports=r},{"../index":1}],12:[function(e,a){var n=e("../index"),r=e("./helpers"),i=e("./definitions"),o={phoneNumber:function(){return r.replaceSymbolWithNumber(n.random.phone_formats())},phoneNumberFormat:function(e){return r.replaceSymbolWithNumber(i.phone_formats[e])},phoneCode:function(){return n.random.phone_codes()}};a.exports=o},{"../index":1,"./definitions":5,"./helpers":7}],13:[function(e,a){var n=e("./definitions"),r=e("../vendor/mersenne"),i=e("../index"),o={number:function(e){if("number"==typeof e)var e={max:e};e=e||{min:0,max:1,precision:1},"undefined"==typeof e.min&&(e.min=0),"undefined"==typeof e.max&&(e.max=1),e.max>0&&e.max++;var a=r.rand(e.max,e.min);return a},array_element:function(e){var a=i.random.number({max:e.length-1});return e[a]},city_prefix:function(){return i.random.array_element(n.city_prefix)},city_suffix:function(){return i.random.array_element(n.city_suffix)},street_suffix:function(){return i.random.array_element(n.street_suffix)},br_state:function(){return i.random.array_element(n.br_state)},br_state_abbr:function(){return i.random.array_element(n.br_state_abbr)},us_state:function(){return i.random.array_element(n.us_state)},us_state_abbr:function(){return i.random.array_element(n.us_state_abbr)},uk_county:function(){return i.random.array_element(n.uk_county)},uk_country:function(){return i.random.array_element(n.uk_country)},first_name:function(){return i.random.array_element(n.first_name)},last_name:function(){return i.random.array_element(n.last_name)},name_prefix:function(){return i.random.array_element(n.name_prefix)},name_suffix:function(){return i.random.array_element(n.name_suffix)},catch_phrase_adjective:function(){return i.random.array_element(n.catch_phrase_adjective)},catch_phrase_descriptor:function(){return i.random.array_element(n.catch_phrase_descriptor)},catch_phrase_noun:function(){return i.random.array_element(n.catch_phrase_noun)},bs_adjective:function(){return i.random.array_element(n.bs_adjective)},bs_buzz:function(){return i.random.array_element(n.bs_buzz)},bs_noun:function(){return i.random.array_element(n.bs_noun)},phone_formats:function(){return i.random.array_element(n.phone_formats)},phone_codes:function(){return i.random.array_element(n.phone_codes)},domain_suffix:function(){return i.random.array_element(n.domain_suffix)},avatar_uri:function(){return i.random.array_element(n.avatar_uri)}};a.exports=o},{"../index":1,"../vendor/mersenne":15,"./definitions":5}],14:[function(require,module,exports){var faker=require("../index"),tree={clone:function(e){if(null==e||"object"!=typeof e)return e;var a=e.constructor();for(var n in e)a[n]=this.clone(e[n]);return a},createTree:function(depth,width,obj){if(!obj)throw{name:"ObjectError",message:"there needs to be an object passed in"};if(0>=width)throw{name:"TreeParamError",message:"width must be greater than zero"};var newObj=this.clone(obj);for(var prop in newObj)if(newObj.hasOwnProperty(prop)){var value=null;if("__RECURSE__"!==newObj[prop])value=eval(newObj[prop]);else if(0!==depth){value=[];var evalWidth=1;evalWidth="function"==typeof width?width():width;for(var i=0;evalWidth>i;i++)value.push(this.createTree(depth-1,width,obj))}newObj[prop]=value}return newObj}};module.exports=tree},{"../index":1}],15:[function(e,a,n){function r(){function e(e){return 0>e?(e^l)+l:e}function a(a,n){return n>a?e(4294967296-(n-a)&4294967295):a-n}function n(a,n){return e(a+n&4294967295)}function r(a,r){for(var i=0,o=0;32>o;++o)a>>>o&1&&(i=n(i,e(r<p;p++)g[p]=n(r(1812433253,e(g[p-1]^g[p-1]>>>30)),p),g[p]=e(4294967295&g[p])},this.init_by_array=function(o,t){var l,s,p;for(this.init_genrand(19650218),l=1,s=0,p=i>t?i:t;p;p--)g[l]=n(n(e(g[l]^r(e(g[l-1]^g[l-1]>>>30),1664525)),o[s]),s),g[l]=e(4294967295&g[l]),l++,s++,l>=i&&(g[0]=g[i-1],l=1),s>=t&&(s=0);for(p=i-1;p;p--)g[l]=a(e((dbg=g[l])^r(e(g[l-1]^g[l-1]>>>30),1566083941)),l),g[l]=e(4294967295&g[l]),l++,l>=i&&(g[0]=g[i-1],l=1);g[0]=2147483648};var d=[0,t];this.genrand_int32=function(){var a;if(p>=i){var n;for(p==i+1&&this.init_genrand(5489),n=0;i-o>n;n++)a=e(g[n]&l|g[n+1]&s),g[n]=e(g[n+o]^a>>>1^d[1&a]);for(;i-1>n;n++)a=e(g[n]&l|g[n+1]&s),g[n]=e(g[n+(o-i)]^a>>>1^d[1&a]);a=e(g[i-1]&l|g[0]&s),g[i-1]=e(g[o-1]^a>>>1^d[1&a]),p=0}return a=g[p++],a=e(a^a>>>11),a=e(a^a<<7&2636928640),a=e(a^a<<15&4022730752),a=e(a^a>>>18)},this.genrand_int31=function(){return this.genrand_int32()>>>1},this.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)},this.genrand_real2=function(){return this.genrand_int32()*(1/4294967296)},this.genrand_real3=function(){return(this.genrand_int32()+.5)*(1/4294967296)},this.genrand_res53=function(){var e=this.genrand_int32()>>>5,a=this.genrand_int32()>>>6;return(67108864*e+a)*(1/9007199254740992)}}n.MersenneTwister19937=r;var i=new r;i.init_genrand((new Date).getTime()%1e9),n.rand=function(e,a){return e||(a=0,e=32768),Math.floor(i.genrand_real2()*(e-a)+a)},n.seed=function(e){if("number"!=typeof e)throw new Error("seed(S) must take numeric argument; is "+typeof e);i.init_genrand(e)},n.seed_array=function(e){if("object"!=typeof e)throw new Error("seed_array(A) must take array of numbers; is "+typeof e);i.init_by_array(e)}},{}]},{},[1])(1)}); \ No newline at end of file