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.
- package/.eslintrc +54 -0
- package/.gitattributes +1 -0
- package/.github/FUNDING.yml +12 -0
- package/.travis.yml +7 -3
- package/.versions +23 -0
- package/Readme.md +1 -46
- package/package.json +70 -23
- package/.jshintrc +0 -87
- package/.npmignore +0 -16
- package/BUILD/BUILD.js +0 -139
- package/BUILD/Mustache.js +0 -296
- package/BUILD/docs.js +0 -62
- package/BUILD/main.js +0 -60
- package/MIT-LICENSE.txt +0 -20
- package/Makefile +0 -26
- package/examples/bigDataSet.json +0 -1
- package/examples/browser_test.html +0 -40
- package/examples/dataSet.json +0 -1
- package/examples/index.html +0 -77
- package/examples/js/faker.js +0 -730
- package/examples/js/jquery.js +0 -154
- package/examples/js/prettyPrint.js +0 -712
- package/examples/library_test.js +0 -9
- package/examples/node_generateSet.js +0 -20
- package/examples/node_min_test.js +0 -9
- package/faker.js +0 -730
- package/index.js +0 -31
- package/lib/address.js +0 -100
- package/lib/company.js +0 -36
- package/lib/date.js +0 -42
- package/lib/definitions.js +0 -1398
- package/lib/helpers.js +0 -124
- package/lib/image.js +0 -58
- package/lib/internet.js +0 -53
- package/lib/lorem.js +0 -45
- package/lib/name.js +0 -34
- package/lib/phone_number.js +0 -16
- package/lib/random.js +0 -106
- package/lib/tree.js +0 -69
- package/lib/version.js +0 -0
- package/logo.png +0 -0
- package/minfaker.js +0 -35
- package/test/address.unit.js +0 -293
- package/test/all.functional.js +0 -47
- package/test/browser.unit.html +0 -28
- package/test/company.unit.js +0 -110
- package/test/date.unit.js +0 -65
- package/test/helpers.unit.js +0 -62
- package/test/image.unit.js +0 -108
- package/test/internet.unit.js +0 -92
- package/test/lorem.unit.js +0 -178
- package/test/mocha.opts +0 -5
- package/test/name.unit.js +0 -87
- package/test/phone_number.unit.js +0 -29
- package/test/run.js +0 -68
- package/test/support/chai.js +0 -3403
- package/test/support/sinon-1.5.2.js +0 -4153
- package/test/support/walk_dir.js +0 -43
- package/test/tree.unit.js +0 -108
- /package/{.jshintignore → .eslintignore} +0 -0
package/test/support/walk_dir.js
DELETED
@@ -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
|