1 | <!DOCTYPE html>
|
2 |
|
3 | <html lang="en">
|
4 | <head>
|
5 | <meta charset="utf-8">
|
6 | <meta name="viewport" content="width=device-width">
|
7 | <title>Documentation Index</title>
|
8 |
|
9 | |
10 |
|
11 |
|
12 | <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
|
13 |
|
14 | <link type="text/css" rel="stylesheet" href="styles/site.simplex.css">
|
15 |
|
16 | </head>
|
17 |
|
18 | <body>
|
19 |
|
20 | <div class="navbar navbar-default navbar-fixed-top ">
|
21 | <div class="container">
|
22 | <div class="navbar-header">
|
23 | <a class="navbar-brand" href="index.html">Documentation</a>
|
24 | <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
|
25 | <span class="icon-bar"></span>
|
26 | <span class="icon-bar"></span>
|
27 | <span class="icon-bar"></span>
|
28 | </button>
|
29 | </div>
|
30 | <div class="navbar-collapse collapse" id="topNavigation">
|
31 | <ul class="nav navbar-nav">
|
32 |
|
33 | <li class="dropdown">
|
34 | <a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a>
|
35 | <ul class="dropdown-menu ">
|
36 | <li><a href="faker.html">faker</a></li><li><a href="faker.address.html">faker.address</a></li><li><a href="faker.commerce.html">faker.commerce</a></li><li><a href="faker.company.html">faker.company</a></li><li><a href="faker.date.html">faker.date</a></li><li><a href="faker.finance.html">faker.finance</a></li><li><a href="faker.hacker.html">faker.hacker</a></li><li><a href="faker.helpers.html">faker.helpers</a></li><li><a href="faker.image.html">faker.image</a></li><li><a href="faker.internet.html">faker.internet</a></li><li><a href="faker.lorem.html">faker.lorem</a></li><li><a href="faker.name.html">faker.name</a></li><li><a href="faker.phone.html">faker.phone</a></li><li><a href="faker.random.html">faker.random</a></li><li><a href="faker.system.html">faker.system</a></li>
|
37 | </ul>
|
38 | </li>
|
39 |
|
40 | </ul>
|
41 | <div class="col-sm-3 col-md-3">
|
42 | <form class="navbar-form" role="search">
|
43 | <div class="input-group">
|
44 | <input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
|
45 | <div class="input-group-btn">
|
46 | <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
|
47 | </div>
|
48 | </div>
|
49 | </form>
|
50 | </div>
|
51 | </div>
|
52 |
|
53 | </div>
|
54 | </div>
|
55 |
|
56 |
|
57 | <div class="container" id="toc-content">
|
58 | <div class="row">
|
59 |
|
60 |
|
61 | <div class="col-md-8">
|
62 |
|
63 | <div id="main">
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 | <section class="readme-section">
|
87 | <article><h1>faker.js - generate massive amounts of fake data in the browser and node.js</h1><p><img src="http://imgur.com/KiinQ.png" alt="Faker.js"></p>
|
88 | <p><a href="https://travis-ci.org/Marak/faker.js"><img src="https://travis-ci.org/Marak/faker.js.svg?branch=master" alt="Build Status"></a></p>
|
89 | <p><a href="http://badge.fury.io/js/faker"><img src="https://badge.fury.io/js/faker.svg" alt="npm version"></a></p>
|
90 | <h2>Demo</h2><p><a href="http://marak.com/faker.js/">http://marak.com/faker.js/</a></p>
|
91 | <h2>Hosted API Microservice</h2><p><a href="http://faker.hook.io/">http://faker.hook.io</a></p>
|
92 | <ul>
|
93 | <li>Supports all Faker API Methods</li>
|
94 | <li>Full-Featured Microservice</li>
|
95 | <li>Hosted by <a href="http://hook.io">hook.io</a></li>
|
96 | </ul>
|
97 | <pre class="prettyprint source lang-bash"><code>curl http://faker.hook.io?property=name.findName&locale=de</code></pre><h2>Usage</h2><h3>Browser</h3><pre class="prettyprint source"><code><script src = "faker.js" type = "text/javascript"></script>
|
98 | <script>
|
99 | var randomName = faker.name.findName(); // Caitlyn Kerluke
|
100 | var randomEmail = faker.internet.email(); // Rusty@arne.info
|
101 | var randomCard = faker.helpers.createCard(); // random contact card containing many properties
|
102 | </script></code></pre><h3>Node.js</h3><pre class="prettyprint source"><code>var faker = require('faker');
|
103 |
|
104 | var randomName = faker.name.findName(); // Rowan Nikolaus
|
105 | var randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz
|
106 | var randomCard = faker.helpers.createCard(); // random contact card containing many properties</code></pre><h2>API</h2><h3>Faker.fake()</h3><p>faker.js contains a super useful generator method <code>Faker.fake</code> for combining faker API methods using a mustache string format.</p>
|
107 | <p><strong>Example:</strong></p>
|
108 | <pre class="prettyprint source lang-js"><code>console.log(faker.fake("{{name.lastName}}, {{name.firstName}} {{name.suffix}}"));
|
109 | // outputs: "Marks, Dean Sr."</code></pre><p>This will interpolate the format string with the value of methods <code>name.lastName()</code>, <code>name.firstName()</code>, and <code>name.suffix()</code></p>
|
110 | <h3>JSDoc API Browser</h3><p><a href="http://marak.github.io/faker.js/">http://marak.github.io/faker.js/</a></p>
|
111 | <h3>API Methods</h3><ul>
|
112 | <li>address<ul>
|
113 | <li>zipCode</li>
|
114 | <li>city</li>
|
115 | <li>cityPrefix</li>
|
116 | <li>citySuffix</li>
|
117 | <li>streetName</li>
|
118 | <li>streetAddress</li>
|
119 | <li>streetSuffix</li>
|
120 | <li>streetPrefix</li>
|
121 | <li>secondaryAddress</li>
|
122 | <li>county</li>
|
123 | <li>country</li>
|
124 | <li>countryCode</li>
|
125 | <li>state</li>
|
126 | <li>stateAbbr</li>
|
127 | <li>latitude</li>
|
128 | <li>longitude</li>
|
129 | </ul>
|
130 | </li>
|
131 | <li>commerce<ul>
|
132 | <li>color</li>
|
133 | <li>department</li>
|
134 | <li>productName</li>
|
135 | <li>price</li>
|
136 | <li>productAdjective</li>
|
137 | <li>productMaterial</li>
|
138 | <li>product</li>
|
139 | </ul>
|
140 | </li>
|
141 | <li>company<ul>
|
142 | <li>suffixes</li>
|
143 | <li>companyName</li>
|
144 | <li>companySuffix</li>
|
145 | <li>catchPhrase</li>
|
146 | <li>bs</li>
|
147 | <li>catchPhraseAdjective</li>
|
148 | <li>catchPhraseDescriptor</li>
|
149 | <li>catchPhraseNoun</li>
|
150 | <li>bsAdjective</li>
|
151 | <li>bsBuzz</li>
|
152 | <li>bsNoun</li>
|
153 | </ul>
|
154 | </li>
|
155 | <li>date<ul>
|
156 | <li>past</li>
|
157 | <li>future</li>
|
158 | <li>between</li>
|
159 | <li>recent</li>
|
160 | <li>month</li>
|
161 | <li>weekday</li>
|
162 | </ul>
|
163 | </li>
|
164 | <li>fake</li>
|
165 | <li>finance<ul>
|
166 | <li>account</li>
|
167 | <li>accountName</li>
|
168 | <li>mask</li>
|
169 | <li>amount</li>
|
170 | <li>transactionType</li>
|
171 | <li>currencyCode</li>
|
172 | <li>currencyName</li>
|
173 | <li>currencySymbol</li>
|
174 | <li>bitcoinAddress</li>
|
175 | </ul>
|
176 | </li>
|
177 | <li>hacker<ul>
|
178 | <li>abbreviation</li>
|
179 | <li>adjective</li>
|
180 | <li>noun</li>
|
181 | <li>verb</li>
|
182 | <li>ingverb</li>
|
183 | <li>phrase</li>
|
184 | </ul>
|
185 | </li>
|
186 | <li>helpers<ul>
|
187 | <li>randomize</li>
|
188 | <li>slugify</li>
|
189 | <li>replaceSymbolWithNumber</li>
|
190 | <li>replaceSymbols</li>
|
191 | <li>shuffle</li>
|
192 | <li>mustache</li>
|
193 | <li>createCard</li>
|
194 | <li>contextualCard</li>
|
195 | <li>userCard</li>
|
196 | <li>createTransaction</li>
|
197 | </ul>
|
198 | </li>
|
199 | <li>image<ul>
|
200 | <li>image</li>
|
201 | <li>avatar</li>
|
202 | <li>imageUrl</li>
|
203 | <li>abstract</li>
|
204 | <li>animals</li>
|
205 | <li>business</li>
|
206 | <li>cats</li>
|
207 | <li>city</li>
|
208 | <li>food</li>
|
209 | <li>nightlife</li>
|
210 | <li>fashion</li>
|
211 | <li>people</li>
|
212 | <li>nature</li>
|
213 | <li>sports</li>
|
214 | <li>technics</li>
|
215 | <li>transport</li>
|
216 | </ul>
|
217 | </li>
|
218 | <li>internet<ul>
|
219 | <li>avatar</li>
|
220 | <li>email</li>
|
221 | <li>exampleEmail</li>
|
222 | <li>userName</li>
|
223 | <li>protocol</li>
|
224 | <li>url</li>
|
225 | <li>domainName</li>
|
226 | <li>domainSuffix</li>
|
227 | <li>domainWord</li>
|
228 | <li>ip</li>
|
229 | <li>userAgent</li>
|
230 | <li>color</li>
|
231 | <li>mac</li>
|
232 | <li>password</li>
|
233 | </ul>
|
234 | </li>
|
235 | <li>lorem<ul>
|
236 | <li>word</li>
|
237 | <li>words</li>
|
238 | <li>sentence</li>
|
239 | <li>sentences</li>
|
240 | <li>paragraph</li>
|
241 | <li>paragraphs</li>
|
242 | <li>text</li>
|
243 | <li>lines</li>
|
244 | </ul>
|
245 | </li>
|
246 | <li>name<ul>
|
247 | <li>firstName</li>
|
248 | <li>lastName</li>
|
249 | <li>findName</li>
|
250 | <li>jobTitle</li>
|
251 | <li>prefix</li>
|
252 | <li>suffix</li>
|
253 | <li>title</li>
|
254 | <li>jobDescriptor</li>
|
255 | <li>jobArea</li>
|
256 | <li>jobType</li>
|
257 | </ul>
|
258 | </li>
|
259 | <li>phone<ul>
|
260 | <li>phoneNumber</li>
|
261 | <li>phoneNumberFormat</li>
|
262 | <li>phoneFormats</li>
|
263 | </ul>
|
264 | </li>
|
265 | <li>random<ul>
|
266 | <li>number</li>
|
267 | <li>arrayElement</li>
|
268 | <li>objectElement</li>
|
269 | <li>uuid</li>
|
270 | <li>boolean</li>
|
271 | <li>word</li>
|
272 | <li>words</li>
|
273 | <li>image</li>
|
274 | <li>locale</li>
|
275 | <li>alphaNumeric</li>
|
276 | </ul>
|
277 | </li>
|
278 | <li>system<ul>
|
279 | <li>fileName</li>
|
280 | <li>commonFileName</li>
|
281 | <li>mimeType</li>
|
282 | <li>commonFileType</li>
|
283 | <li>commonFileExt</li>
|
284 | <li>fileType</li>
|
285 | <li>fileExt</li>
|
286 | <li>directoryPath</li>
|
287 | <li>filePath</li>
|
288 | <li>semver</li>
|
289 | </ul>
|
290 | </li>
|
291 | </ul>
|
292 | <h2>Localization</h2><p>As of version <code>v2.0.0</code> faker.js has support for multiple localities.</p>
|
293 | <p>The default language locale is set to English.</p>
|
294 | <p>Setting a new locale is simple:</p>
|
295 | <pre class="prettyprint source lang-js"><code>// sets locale to de
|
296 | faker.locale = "de";</code></pre><ul>
|
297 | <li>de</li>
|
298 | <li>de_AT</li>
|
299 | <li>de_CH</li>
|
300 | <li>en</li>
|
301 | <li>en_AU</li>
|
302 | <li>en_BORK</li>
|
303 | <li>en_CA</li>
|
304 | <li>en_GB</li>
|
305 | <li>en_IE</li>
|
306 | <li>en_IND</li>
|
307 | <li>en_US</li>
|
308 | <li>en_au_ocker</li>
|
309 | <li>es</li>
|
310 | <li>es_MX</li>
|
311 | <li>fa</li>
|
312 | <li>fr</li>
|
313 | <li>fr_CA</li>
|
314 | <li>ge</li>
|
315 | <li>id_ID</li>
|
316 | <li>it</li>
|
317 | <li>ja</li>
|
318 | <li>ko</li>
|
319 | <li>nb_NO</li>
|
320 | <li>nep</li>
|
321 | <li>nl</li>
|
322 | <li>pl</li>
|
323 | <li>pt_BR</li>
|
324 | <li>ru</li>
|
325 | <li>sk</li>
|
326 | <li>sv</li>
|
327 | <li>tr</li>
|
328 | <li>uk</li>
|
329 | <li>vi</li>
|
330 | <li>zh_CN</li>
|
331 | <li>zh_TW</li>
|
332 | </ul>
|
333 | <h3>Individual Localization Packages</h3><p>As of vesion <code>v3.0.0</code> faker.js supports incremental loading of locales. </p>
|
334 | <p>By default, requiring <code>faker</code> will include <em>all</em> locale data.</p>
|
335 | <p>In a production environment, you may only want to include the locale data for a specific set of locales.</p>
|
336 | <pre class="prettyprint source lang-js"><code>// loads only de locale
|
337 | var faker = require('faker/locale/de');</code></pre><h2>Tests</h2><pre class="prettyprint source"><code>npm install .
|
338 | make test</code></pre><p>You can view a code coverage report generated in coverage/lcov-report/index.html.</p>
|
339 | <h2>Projects Built with faker.js</h2><h3>Fake JSON Schema</h3><p>Use faker generators to populate JSON Schema samples.
|
340 | See: https://github.com/pateketrueke/json-schema-faker/</p>
|
341 | <h3>CLI</h3><p>Run faker generators from Command Line.
|
342 | See: https://github.com/lestoni/faker-cli</p>
|
343 | <p><strong>Want to see your project added here? Let us know!</strong></p>
|
344 | <h3>Meteor</h3><h4>Meteor Installation</h4><pre class="prettyprint source"><code>meteor add practicalmeteor:faker</code></pre><h4>Meteor Usage, both client and server</h4><pre class="prettyprint source lang-js"><code>var randomName = faker.name.findName(); // Rowan Nikolaus
|
345 | var randomEmail = faker.internet.email(); // Kassandra.Haley@erich.biz
|
346 | var randomCard = faker.helpers.createCard(); // random contact card containing many properties</code></pre><h2>Building faker.js</h2><p>faker uses <a href="http://gulpjs.com/">gulp</a> to automate it's build process. Running the following build command will generate new browser builds, documentation, and code examples for the project.</p>
|
347 | <pre class="prettyprint source"><code>npm run-script build</code></pre><h2>Building JSDocs</h2><pre class="prettyprint source"><code>npm run-script doc</code></pre><h2>Version Release Schedule</h2><p>faker.js is a popular project used by many organizations and individuals in production settings. Major and Minor version releases are generally on a monthly schedule. Bugs fixes are addressed by severity and fixed as soon as possible.</p>
|
348 | <p>If you require the absolute latest version of <code>faker.js</code> the <code>master</code> branch @ http://github.com/marak/faker.js/ should always be up to date and working.</p>
|
349 | <h2>Maintainer</h2><h4>Marak Squires</h4><p>faker.js - Copyright (c) 2016
|
350 | Matthew Bergman & Marak Squires
|
351 | http://github.com/marak/faker.js/</p>
|
352 | <p>faker.js was inspired by and has used data definitions from:</p>
|
353 | <ul>
|
354 | <li>https://github.com/stympy/faker/ - Copyright (c) 2007-2010 Benjamin Curtis</li>
|
355 | <li>http://search.cpan.org/~jasonk/Data-Faker-0.07/ - Copyright 2004-2005 by Jason Kohles</li>
|
356 | </ul>
|
357 | <p>Permission is hereby granted, free of charge, to any person obtaining
|
358 | a copy of this software and associated documentation files (the
|
359 | "Software"), to deal in the Software without restriction, including
|
360 | without limitation the rights to use, copy, modify, merge, publish,
|
361 | distribute, sublicense, and/or sell copies of the Software, and to
|
362 | permit persons to whom the Software is furnished to do so, subject to
|
363 | the following conditions:</p>
|
364 | <p>The above copyright notice and this permission notice shall be
|
365 | included in all copies or substantial portions of the Software.</p>
|
366 | <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
367 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
368 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
369 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
370 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
371 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
372 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p></article>
|
373 | </section>
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 | </div>
|
382 | </div>
|
383 |
|
384 | <div class="clearfix"></div>
|
385 |
|
386 |
|
387 | <div class="col-md-3">
|
388 | <div id="toc" class="col-md-3 hidden-xs hidden-sm hidden-md"></div>
|
389 | </div>
|
390 |
|
391 |
|
392 | </div>
|
393 | </div>
|
394 |
|
395 | <div class="modal fade" id="searchResults">
|
396 | <div class="modal-dialog">
|
397 | <div class="modal-content">
|
398 | <div class="modal-header">
|
399 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
400 | <h4 class="modal-title">Search results</h4>
|
401 | </div>
|
402 | <div class="modal-body"></div>
|
403 | <div class="modal-footer">
|
404 | <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
405 | </div>
|
406 | </div>
|
407 | </div>
|
408 | </div>
|
409 |
|
410 | <footer>
|
411 |
|
412 |
|
413 | <span class="jsdoc-message">
|
414 | Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a>
|
415 |
|
416 | on 2016-03-20T21:12:53-04:00
|
417 |
|
418 | using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
|
419 | </span>
|
420 | </footer>
|
421 |
|
422 | <script src="scripts/docstrap.lib.js"></script>
|
423 | <script src="scripts/toc.js"></script>
|
424 | <script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
|
425 |
|
426 | <script>
|
427 | $( function () {
|
428 | $( "[id*='$']" ).each( function () {
|
429 | var $this = $( this );
|
430 |
|
431 | $this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
|
432 | } );
|
433 |
|
434 | $( ".tutorial-section pre, .readme-section pre" ).each( function () {
|
435 | var $this = $( this );
|
436 |
|
437 | var example = $this.find( "code" );
|
438 | exampleText = example.html();
|
439 | var lang = /{@lang (.*?)}/.exec( exampleText );
|
440 | if ( lang && lang[1] ) {
|
441 | exampleText = exampleText.replace( lang[0], "" );
|
442 | example.html( exampleText );
|
443 | lang = lang[1];
|
444 | } else {
|
445 | var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
|
446 | lang = langClassMatch ? langClassMatch[1] : "javascript";
|
447 | }
|
448 |
|
449 | if ( lang ) {
|
450 |
|
451 | $this
|
452 | .addClass( "sunlight-highlight-" + lang )
|
453 | .addClass( "linenums" )
|
454 | .html( example.html() );
|
455 |
|
456 | }
|
457 | } );
|
458 |
|
459 | Sunlight.highlightAll( {
|
460 | lineNumbers : false,
|
461 | showMenu : true,
|
462 | enableDoclinks : true
|
463 | } );
|
464 |
|
465 | $.catchAnchorLinks( {
|
466 | navbarOffset: 10
|
467 | } );
|
468 | $( "#toc" ).toc( {
|
469 | anchorName : function ( i, heading, prefix ) {
|
470 | var id = $( heading ).attr( "id" );
|
471 | return id && id.replace(/\~/g, '-inner-').replace(/\./g, '-static-') || ( prefix + i );
|
472 | },
|
473 | selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
|
474 | showAndHide : false,
|
475 | smoothScrolling: true
|
476 | } );
|
477 |
|
478 | $( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
479 | $( '.dropdown-toggle' ).dropdown();
|
480 |
|
481 | $( "table" ).each( function () {
|
482 | var $this = $( this );
|
483 | $this.addClass('table');
|
484 | } );
|
485 |
|
486 | } );
|
487 | </script>
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 | <script type="text/javascript">
|
498 | $(document).ready(function() {
|
499 | SearcherDisplay.init();
|
500 | });
|
501 | </script>
|
502 |
|
503 | </body>
|
504 | </html> |
\ | No newline at end of file |