faker 1.0.0 → 6.6.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of faker might be problematic. Click here for more details.

Files changed (60) hide show
  1. package/.eslintrc +54 -0
  2. package/.gitattributes +1 -0
  3. package/.github/FUNDING.yml +12 -0
  4. package/.travis.yml +7 -3
  5. package/.versions +23 -0
  6. package/Readme.md +1 -46
  7. package/package.json +70 -23
  8. package/.jshintrc +0 -87
  9. package/.npmignore +0 -16
  10. package/BUILD/BUILD.js +0 -139
  11. package/BUILD/Mustache.js +0 -296
  12. package/BUILD/docs.js +0 -62
  13. package/BUILD/main.js +0 -60
  14. package/MIT-LICENSE.txt +0 -20
  15. package/Makefile +0 -26
  16. package/examples/bigDataSet.json +0 -1
  17. package/examples/browser_test.html +0 -40
  18. package/examples/dataSet.json +0 -1
  19. package/examples/index.html +0 -77
  20. package/examples/js/faker.js +0 -730
  21. package/examples/js/jquery.js +0 -154
  22. package/examples/js/prettyPrint.js +0 -712
  23. package/examples/library_test.js +0 -9
  24. package/examples/node_generateSet.js +0 -20
  25. package/examples/node_min_test.js +0 -9
  26. package/faker.js +0 -730
  27. package/index.js +0 -31
  28. package/lib/address.js +0 -100
  29. package/lib/company.js +0 -36
  30. package/lib/date.js +0 -42
  31. package/lib/definitions.js +0 -1398
  32. package/lib/helpers.js +0 -124
  33. package/lib/image.js +0 -58
  34. package/lib/internet.js +0 -53
  35. package/lib/lorem.js +0 -45
  36. package/lib/name.js +0 -34
  37. package/lib/phone_number.js +0 -16
  38. package/lib/random.js +0 -106
  39. package/lib/tree.js +0 -69
  40. package/lib/version.js +0 -0
  41. package/logo.png +0 -0
  42. package/minfaker.js +0 -35
  43. package/test/address.unit.js +0 -293
  44. package/test/all.functional.js +0 -47
  45. package/test/browser.unit.html +0 -28
  46. package/test/company.unit.js +0 -110
  47. package/test/date.unit.js +0 -65
  48. package/test/helpers.unit.js +0 -62
  49. package/test/image.unit.js +0 -108
  50. package/test/internet.unit.js +0 -92
  51. package/test/lorem.unit.js +0 -178
  52. package/test/mocha.opts +0 -5
  53. package/test/name.unit.js +0 -87
  54. package/test/phone_number.unit.js +0 -29
  55. package/test/run.js +0 -68
  56. package/test/support/chai.js +0 -3403
  57. package/test/support/sinon-1.5.2.js +0 -4153
  58. package/test/support/walk_dir.js +0 -43
  59. package/test/tree.unit.js +0 -108
  60. /package/{.jshintignore → .eslintignore} +0 -0
@@ -1,43 +0,0 @@
1
- var fs = require('fs');
2
-
3
- var methods = {
4
- walk: function (dir, validation_function, cb) {
5
- if (arguments.length === 2) {
6
- cb = validation_function;
7
- validation_function = null;
8
- }
9
-
10
- var results = [];
11
- fs.readdir(dir, function (err, list) {
12
- if (err) { return cb(err); }
13
-
14
- var pending = list.length;
15
-
16
- if (!pending) { return cb(null, results); }
17
-
18
- list.forEach(function (file) {
19
- file = dir + '/' + file;
20
- fs.stat(file, function (err, stat) {
21
- if (stat && stat.isDirectory()) {
22
- methods.walk(file, validation_function, function (err, res) {
23
- results = results.concat(res);
24
- if (!--pending) { cb(null, results); }
25
- });
26
- } else {
27
- if (typeof validation_function === 'function') {
28
- if (validation_function(file)) {
29
- results.push(file);
30
- }
31
- } else {
32
- results.push(file);
33
- }
34
-
35
- if (!--pending) { cb(null, results); }
36
- }
37
- });
38
- });
39
- });
40
- }
41
- };
42
-
43
- module.exports = methods;
package/test/tree.unit.js DELETED
@@ -1,108 +0,0 @@
1
- if (typeof module !== 'undefined') {
2
- var assert = require('assert');
3
- var sinon = require('sinon');
4
- var faker = require('../index');
5
- }
6
-
7
- describe("tree.js", function () {
8
- describe("createTree()", function () {
9
-
10
- var proto = {
11
- "firstname": "faker.random.first_name()",
12
- "children": "__RECURSE__"
13
- };
14
-
15
- it("requires the width to be at least one", function () {
16
- sinon.spy(faker.Tree, 'createTree');
17
-
18
- try {
19
- faker.Tree.createTree(0, 0, {});
20
- }
21
- catch (e) {
22
- }
23
-
24
- assert.ok(faker.Tree.createTree.threw);
25
-
26
- faker.Tree.createTree.restore();
27
- });
28
-
29
- it("requires that the object passed in should not be null", function () {
30
- sinon.spy(faker.Tree, 'createTree');
31
-
32
- try {
33
- faker.Tree.createTree(1, 1, null);
34
- }
35
- catch (e) {
36
- }
37
-
38
- assert.ok(faker.Tree.createTree.threw);
39
-
40
- faker.Tree.createTree.restore();
41
-
42
- });
43
-
44
- it("can create a trivial tree with one node", function () {
45
- sinon.spy(faker.random, 'first_name');
46
-
47
- var tree = faker.Tree.createTree(0, 1, proto);
48
-
49
- assert.ok(faker.random.first_name.calledOnce);
50
-
51
- assert.ok(tree.children == null);
52
-
53
- faker.random.first_name.restore();
54
- });
55
-
56
- it("can create a deep tree with one node at each level", function () {
57
- sinon.spy(faker.random, 'first_name');
58
- var tree = faker.Tree.createTree(2, 1, proto);
59
-
60
- assert.ok(faker.random.first_name.calledThrice);
61
-
62
- assert.ok(tree.firstname);
63
- assert.ok(tree.children[0].firstname);
64
- assert.ok(tree.children[0].children[0].firstname);
65
-
66
- faker.random.first_name.restore();
67
- });
68
-
69
- it("can create a basic N-tree", function () {
70
- var n = 3;
71
- sinon.spy(faker.random, 'first_name');
72
- var tree = faker.Tree.createTree(1, n, proto);
73
-
74
- assert.ok(faker.random.first_name.callCount == 4);
75
-
76
- assert.ok(tree.firstname);
77
- assert.ok(tree.children[0].firstname);
78
- assert.ok(tree.children[1].firstname);
79
- assert.ok(tree.children[2].firstname);
80
-
81
- faker.random.first_name.restore();
82
- });
83
-
84
- it("can create a full N-tree", function () {
85
- var n = 3;
86
- sinon.spy(faker.random, 'first_name');
87
- var tree = faker.Tree.createTree(2, n, proto);
88
-
89
- assert.ok(faker.random.first_name.callCount == 13);
90
-
91
- faker.random.first_name.restore();
92
- });
93
-
94
- it("can accept a function for the width", function () {
95
- var widthFuncCalled = 0;
96
- var widthFunc = function () {
97
- widthFuncCalled = widthFuncCalled + 1;
98
- return 2;
99
- };
100
-
101
- var tree = faker.Tree.createTree(2, widthFunc, proto);
102
- assert.equal(widthFuncCalled, 3);
103
-
104
-
105
- });
106
-
107
- });
108
- });
File without changes