aboutsummaryrefslogtreecommitdiff
path: root/examples/node/unique-values.js
diff options
context:
space:
mode:
authorDamien Retzinger <[email protected]>2022-01-21 13:19:54 -0500
committerGitHub <[email protected]>2022-01-21 19:19:54 +0100
commit51a95d8db5bf18edc183040b03c84310a1710455 (patch)
tree9afeae16c6eeb3fb842d15d1d686a60ee27d55db /examples/node/unique-values.js
parent93e8e535ba5bf85fae029078941523ce566fb356 (diff)
downloadfaker-51a95d8db5bf18edc183040b03c84310a1710455.tar.xz
faker-51a95d8db5bf18edc183040b03c84310a1710455.zip
chore: delete old examples and doc folder (#155)
Co-authored-by: Shinigami92 <[email protected]>
Diffstat (limited to 'examples/node/unique-values.js')
-rw-r--r--examples/node/unique-values.js28
1 files changed, 0 insertions, 28 deletions
diff --git a/examples/node/unique-values.js b/examples/node/unique-values.js
deleted file mode 100644
index bdbf5edf..00000000
--- a/examples/node/unique-values.js
+++ /dev/null
@@ -1,28 +0,0 @@
-var faker = require('../../lib').faker;
-
-var emails = {};
-var conflicts = 0;
-// emails estimated: 1,055,881
-// full names estimated: 1,185,139
-for (var i = 0; i < 100000; i++) {
- // call function with no arguments
- var email = faker.unique(faker.internet.email);
-
- // or with function arguments as argument array
- // var email = faker.unique(faker.internet.email, [null, null, 'marak.com']);
-
- // or with custom options for maxTime as milliseconds or maxRetries
- // var email = faker.unique(faker.internet.email, [null, null, 'marak.com'], { maxRetries: 1, maxTime: 50 });
-
- if (typeof emails[email] === 'undefined') {
- // found a unique new item
- emails[email] = true;
- } else {
- // found a conflicting item ( should not happen using faker.unique() )
- conflicts++;
- }
-}
-console.log('total conflicts', conflicts); // should be zero using faker.unique()
-console.log('total uniques generated', Object.keys(emails).length);
-
-// console.log(emails);