randex 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/lib/custom/email.d.ts +0 -3
  2. package/lib/custom/email.js +0 -41
  3. package/lib/custom/filename.d.ts +0 -4
  4. package/lib/custom/filename.js +0 -41
  5. package/lib/custom/fullname.d.ts +0 -5
  6. package/lib/custom/fullname.js +0 -33
  7. package/lib/custom/index.d.ts +41 -5
  8. package/lib/custom/index.js +309 -5
  9. package/lib/custom/number.d.ts +0 -3
  10. package/lib/custom/number.js +0 -37
  11. package/lib/custom/random.d.ts +5 -0
  12. package/lib/custom/random.js +2 -0
  13. package/lib/custom/singleName.d.ts +5 -0
  14. package/lib/custom/singleName.js +2 -0
  15. package/lib/custom/username.d.ts +0 -1
  16. package/lib/custom/username.js +0 -10
  17. package/lib/index.d.ts +3 -1
  18. package/lib/index.js +4 -1
  19. package/lib/test/array-item.test.js +2 -2
  20. package/lib/test/array.test.js +2 -2
  21. package/lib/test/email.test.js +8 -8
  22. package/lib/test/filename.test.js +10 -10
  23. package/lib/test/fullname.test.js +1 -1
  24. package/lib/test/markdown.test.js +34 -35
  25. package/lib/test/name.test.js +10 -10
  26. package/lib/test/number-array.test.js +5 -5
  27. package/lib/test/number.test.js +6 -6
  28. package/lib/test/params.test.js +15 -15
  29. package/lib/test/random.test.js +11 -11
  30. package/lib/test/username.test.js +8 -8
  31. package/package.json +1 -1
  32. package/lib/basic/index.d.ts +0 -2
  33. package/lib/basic/index.js +0 -83
  34. package/lib/custom/array-item.d.ts +0 -2
  35. package/lib/custom/array-item.js +0 -18
  36. package/lib/custom/array.d.ts +0 -1
  37. package/lib/custom/array.js +0 -21
  38. package/lib/custom/bool.d.ts +0 -1
  39. package/lib/custom/bool.js +0 -7
  40. package/lib/custom/name.d.ts +0 -9
  41. package/lib/custom/name.js +0 -30
  42. package/lib/custom/number-array.d.ts +0 -2
  43. package/lib/custom/number-array.js +0 -30
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var set_1 = require("../basic/set");
4
- var email_1 = require("../custom/email");
4
+ var custom_1 = require("../custom");
5
5
  var test_util_1 = require("./test-util");
6
6
  var r = set_1.RandexSetUtil;
7
7
  function splitEmail(email) {
@@ -25,16 +25,16 @@ function testEmail(options) {
25
25
  describe("randomEmail", function () {
26
26
  it("simple", function () {
27
27
  test_util_1.TestUtil.loop(function () {
28
- var email = (0, email_1.randomEmail)();
28
+ var email = custom_1.Randex.email();
29
29
  testEmail({ email: email });
30
30
  });
31
31
  });
32
32
  it("options: prefixLength", function () {
33
33
  var prefixLength = [10, 15];
34
34
  test_util_1.TestUtil.loop(function () {
35
- var email = (0, email_1.randomEmail)({ prefixLength: prefixLength });
35
+ var email = custom_1.Randex.email({ prefixLength: prefixLength });
36
36
  testEmail({ email: email, prefixLength: prefixLength });
37
- email = (0, email_1.randomEmail)(prefixLength);
37
+ email = custom_1.Randex.email(prefixLength);
38
38
  testEmail({ email: email, prefixLength: prefixLength });
39
39
  });
40
40
  });
@@ -42,18 +42,18 @@ describe("randomEmail", function () {
42
42
  var hightDomainLength = 8;
43
43
  var lowDomainLength = 12;
44
44
  test_util_1.TestUtil.loop(function () {
45
- var email = (0, email_1.randomEmail)({ hightDomainLength: hightDomainLength, lowDomainLength: lowDomainLength });
45
+ var email = custom_1.Randex.email({ hightDomainLength: hightDomainLength, lowDomainLength: lowDomainLength });
46
46
  testEmail({ email: email, hightDomainLength: hightDomainLength, lowDomainLength: lowDomainLength });
47
- email = (0, email_1.randomEmail)(r.defaultEmailPrefixLength, lowDomainLength, hightDomainLength);
47
+ email = custom_1.Randex.email(r.defaultEmailPrefixLength, lowDomainLength, hightDomainLength);
48
48
  testEmail({ email: email, hightDomainLength: hightDomainLength, lowDomainLength: lowDomainLength, prefixLength: r.defaultEmailPrefixLength });
49
49
  });
50
50
  });
51
51
  it("options: domain", function () {
52
52
  var domain = "delta.com";
53
53
  test_util_1.TestUtil.loop(function () {
54
- var email = (0, email_1.randomEmail)({ domain: domain });
54
+ var email = custom_1.Randex.email({ domain: domain });
55
55
  testEmail({ email: email, domain: domain });
56
- email = (0, email_1.randomEmail)(domain);
56
+ email = custom_1.Randex.email(domain);
57
57
  testEmail({ email: email, domain: domain });
58
58
  });
59
59
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var set_1 = require("../basic/set");
4
- var filename_1 = require("../custom/filename");
4
+ var custom_1 = require("../custom");
5
5
  var test_util_1 = require("./test-util");
6
6
  var r = set_1.RandexSetUtil;
7
7
  function splitFileName(fullFileName) {
@@ -27,25 +27,25 @@ function testFileName(options) {
27
27
  describe("randomFileName", function () {
28
28
  it("simple", function () {
29
29
  test_util_1.TestUtil.loop(function () {
30
- var fullFileName = (0, filename_1.randomFileName)();
30
+ var fullFileName = custom_1.Randex.fileName();
31
31
  testFileName({ fullFileName: fullFileName });
32
32
  });
33
33
  });
34
34
  it("params: fileNameLength", function () {
35
35
  var fileNameLength = [10, 15];
36
36
  test_util_1.TestUtil.loop(function () {
37
- var fullFileName = (0, filename_1.randomFileName)({ fileNameLength: fileNameLength });
37
+ var fullFileName = custom_1.Randex.fileName({ fileNameLength: fileNameLength });
38
38
  testFileName({ fullFileName: fullFileName, fileNameLength: fileNameLength });
39
- fullFileName = (0, filename_1.randomFileName)(fileNameLength);
39
+ fullFileName = custom_1.Randex.fileName(fileNameLength);
40
40
  testFileName({ fullFileName: fullFileName, fileNameLength: fileNameLength });
41
41
  });
42
42
  });
43
43
  it("params: extensionLength", function () {
44
44
  var extensionLength = [10, 15];
45
45
  test_util_1.TestUtil.loop(function () {
46
- var fullFileName = (0, filename_1.randomFileName)({ extensionLength: extensionLength });
46
+ var fullFileName = custom_1.Randex.fileName({ extensionLength: extensionLength });
47
47
  testFileName({ fullFileName: fullFileName, extensionLength: extensionLength });
48
- fullFileName = (0, filename_1.randomFileName)(r.defaultFileNameLength, extensionLength);
48
+ fullFileName = custom_1.Randex.fileName(r.defaultFileNameLength, extensionLength);
49
49
  testFileName({ fullFileName: fullFileName, fileNameLength: r.defaultFileNameLength, extensionLength: extensionLength });
50
50
  });
51
51
  });
@@ -53,13 +53,13 @@ describe("randomFileName", function () {
53
53
  var fileNameLength = [10, 15];
54
54
  var extension = "xml";
55
55
  test_util_1.TestUtil.loop(function () {
56
- var fullFileName = (0, filename_1.randomFileName)({ extension: extension });
56
+ var fullFileName = custom_1.Randex.fileName({ extension: extension });
57
57
  testFileName({ fullFileName: fullFileName, extension: extension });
58
- fullFileName = (0, filename_1.randomFileName)(extension);
58
+ fullFileName = custom_1.Randex.fileName(extension);
59
59
  testFileName({ fullFileName: fullFileName, extension: extension });
60
- fullFileName = (0, filename_1.randomFileName)("." + extension);
60
+ fullFileName = custom_1.Randex.fileName("." + extension);
61
61
  testFileName({ fullFileName: fullFileName, extension: extension });
62
- fullFileName = (0, filename_1.randomFileName)(fileNameLength, extension);
62
+ fullFileName = custom_1.Randex.fileName(fileNameLength, extension);
63
63
  testFileName({ fullFileName: fullFileName, fileNameLength: fileNameLength, extension: extension });
64
64
  });
65
65
  });
@@ -5,7 +5,7 @@ var test_util_1 = require("./test-util");
5
5
  describe("randomFullName", function () {
6
6
  it("simple", function () {
7
7
  test_util_1.TestUtil.loop(function () {
8
- var value = (0, custom_1.randomFullName)();
8
+ var value = custom_1.Randex.fullName();
9
9
  expect(test_util_1.TestUtil.isFullNameValid(value)).toBeTruthy();
10
10
  });
11
11
  });
@@ -1,56 +1,55 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var basic_1 = require("../basic");
4
3
  var custom_1 = require("../custom");
5
4
  describe("markdown", function () {
6
5
  it("random", function () {
7
- var value = (0, basic_1.random)({
6
+ var value = custom_1.Randex.random({
8
7
  set: "english",
9
8
  length: 3,
10
9
  });
11
10
  expect(value.length).toBe(3);
12
- value = (0, basic_1.random)(["english", 3]);
11
+ value = custom_1.Randex.random(["english", 3]);
13
12
  expect(value.length).toBe(3);
14
13
  //
15
- value = (0, basic_1.random)({
14
+ value = custom_1.Randex.random({
16
15
  set: ["english", "lower"],
17
16
  length: 3,
18
17
  });
19
18
  expect(value.length).toBe(3);
20
- value = (0, basic_1.random)([["english", "lower"], 3]);
19
+ value = custom_1.Randex.random([["english", "lower"], 3]);
21
20
  expect(value.length).toBe(3);
22
21
  //
23
- value = (0, basic_1.random)({
22
+ value = custom_1.Randex.random({
24
23
  set: "english",
25
24
  length: [1, 3],
26
25
  });
27
26
  expect(value.length).toBeLessThanOrEqual(3);
28
- value = (0, basic_1.random)(["english", [1, 3]]);
27
+ value = custom_1.Randex.random(["english", [1, 3]]);
29
28
  expect(value.length).toBeLessThanOrEqual(3);
30
29
  //
31
- value = (0, basic_1.random)({
30
+ value = custom_1.Randex.random({
32
31
  set: "number",
33
32
  length: 3,
34
33
  });
35
34
  expect(value.length).toBe(3);
36
- value = (0, basic_1.random)(["number", 3]);
35
+ value = custom_1.Randex.random(["number", 3]);
37
36
  expect(value.length).toBe(3);
38
37
  //
39
- value = (0, basic_1.random)({
38
+ value = custom_1.Randex.random({
40
39
  range: "abc123",
41
40
  length: 3,
42
41
  });
43
42
  expect(value.length).toBe(3);
44
43
  //
45
- value = (0, basic_1.random)({
44
+ value = custom_1.Randex.random({
46
45
  set: ["english", "number"],
47
46
  length: 3,
48
47
  });
49
48
  expect(value.length).toBe(3);
50
- value = (0, basic_1.random)([["english", "number"], 3]);
49
+ value = custom_1.Randex.random([["english", "number"], 3]);
51
50
  expect(value.length).toBe(3);
52
51
  //
53
- value = (0, basic_1.random)({
52
+ value = custom_1.Randex.random({
54
53
  set: "english",
55
54
  length: 2,
56
55
  }, {
@@ -58,61 +57,61 @@ describe("markdown", function () {
58
57
  length: 2,
59
58
  });
60
59
  expect(value.length).toBe(4);
61
- value = (0, basic_1.random)(["english", 2], [["english", "number"], 2]);
60
+ value = custom_1.Randex.random(["english", 2], [["english", "number"], 2]);
62
61
  expect(value.length).toBe(4);
63
62
  });
64
63
  it("randomFileName", function () {
65
- var value = (0, custom_1.randomFileName)();
66
- value = (0, custom_1.randomFileName)({
64
+ var value = custom_1.Randex.fileName();
65
+ value = custom_1.Randex.fileName({
67
66
  extension: "txt",
68
67
  });
69
- value = (0, custom_1.randomFileName)("txt");
70
- value = (0, custom_1.randomFileName)({
68
+ value = custom_1.Randex.fileName("txt");
69
+ value = custom_1.Randex.fileName({
71
70
  fileNameLength: [7, 10],
72
71
  extensionLength: 5,
73
72
  });
74
- value = (0, custom_1.randomFileName)([7, 10], 5);
75
- value = (0, custom_1.randomFileName)({
73
+ value = custom_1.Randex.fileName([7, 10], 5);
74
+ value = custom_1.Randex.fileName({
76
75
  fileNameLength: 8,
77
76
  extension: "xml",
78
77
  });
79
- value = (0, custom_1.randomFileName)(8, "xml");
78
+ value = custom_1.Randex.fileName(8, "xml");
80
79
  expect(value).toBeTruthy();
81
80
  });
82
81
  it("randomUsername", function () {
83
- var value = (0, custom_1.randomUsername)();
82
+ var value = custom_1.Randex.username();
84
83
  expect(value).toBeTruthy();
85
84
  });
86
85
  it("randomEmail", function () {
87
- var value = (0, custom_1.randomEmail)();
88
- value = (0, custom_1.randomEmail)({
86
+ var value = custom_1.Randex.email();
87
+ value = custom_1.Randex.email({
89
88
  prefixLength: 8,
90
89
  });
91
- value = (0, custom_1.randomEmail)(8);
92
- value = (0, custom_1.randomEmail)({
90
+ value = custom_1.Randex.email(8);
91
+ value = custom_1.Randex.email({
93
92
  prefixLength: 8,
94
93
  lowDomainLength: 4,
95
94
  hightDomainLength: 2,
96
95
  });
97
- value = (0, custom_1.randomEmail)(8, 4, 2);
98
- value = (0, custom_1.randomEmail)({
96
+ value = custom_1.Randex.email(8, 4, 2);
97
+ value = custom_1.Randex.email({
99
98
  domain: "test.com",
100
99
  });
101
- value = (0, custom_1.randomEmail)("test.com");
100
+ value = custom_1.Randex.email("test.com");
102
101
  expect(value).toBeTruthy();
103
102
  });
104
- it("randomName", function () {
105
- var value = (0, custom_1.randomName)();
103
+ it("singleName", function () {
104
+ var value = custom_1.Randex.singleName();
106
105
  expect(value).toBeTruthy();
107
- value = (0, custom_1.randomName)({ alphabet: "french" });
106
+ value = custom_1.Randex.singleName({ alphabet: "french" });
108
107
  expect(value).toBeTruthy();
109
- value = (0, custom_1.randomName)({ length: 5 });
108
+ value = custom_1.Randex.singleName({ length: 5 });
110
109
  expect(value).toBeTruthy();
111
- value = (0, custom_1.randomName)({ length: [2, 5] });
110
+ value = custom_1.Randex.singleName({ length: [2, 5] });
112
111
  expect(value).toBeTruthy();
113
112
  });
114
113
  it("randomFullName", function () {
115
- var value = (0, custom_1.randomFullName)();
114
+ var value = custom_1.Randex.fullName();
116
115
  expect(value).toBeTruthy();
117
116
  });
118
117
  });
@@ -1,34 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var name_1 = require("../custom/name");
3
+ var custom_1 = require("../custom");
4
4
  var test_util_1 = require("./test-util");
5
5
  describe("randomName", function () {
6
6
  it("simple", function () {
7
7
  test_util_1.TestUtil.loop(function () {
8
- var value = (0, name_1.randomName)();
8
+ var value = custom_1.Randex.singleName();
9
9
  expect(test_util_1.TestUtil.isNameValid(value)).toBeTruthy();
10
10
  });
11
11
  });
12
12
  it("options: length", function () {
13
- var value = (0, name_1.randomName)({ length: 5 });
13
+ var value = custom_1.Randex.singleName({ length: 5 });
14
14
  expect(value.length).toBe(5);
15
- value = (0, name_1.randomName)(5);
15
+ value = custom_1.Randex.singleName(5);
16
16
  expect(value.length).toBe(5);
17
17
  //
18
- value = (0, name_1.randomName)({ length: [5, 5] });
18
+ value = custom_1.Randex.singleName({ length: [5, 5] });
19
19
  expect(value.length).toBe(5);
20
- value = (0, name_1.randomName)([5, 5]);
20
+ value = custom_1.Randex.singleName([5, 5]);
21
21
  expect(value.length).toBe(5);
22
22
  //
23
- value = (0, name_1.randomName)({ length: [1, 5] });
23
+ value = custom_1.Randex.singleName({ length: [1, 5] });
24
24
  expect(test_util_1.TestUtil.inNumberRange(value.length, [1, 5])).toBeTruthy();
25
- value = (0, name_1.randomName)([1, 5]);
25
+ value = custom_1.Randex.singleName([1, 5]);
26
26
  expect(test_util_1.TestUtil.inNumberRange(value.length, [1, 5])).toBeTruthy();
27
27
  });
28
28
  it("options: alphabet", function () {
29
- var value = (0, name_1.randomName)({ alphabet: "russian", length: 5 });
29
+ var value = custom_1.Randex.singleName({ alphabet: "russian", length: 5 });
30
30
  expect(value.length).toBe(5);
31
- value = (0, name_1.randomName)("french", 10);
31
+ value = custom_1.Randex.singleName("french", 10);
32
32
  expect(value.length).toBe(10);
33
33
  });
34
34
  });
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var number_array_1 = require("../custom/number-array");
3
+ var custom_1 = require("../custom");
4
4
  function testNumber(min, max, count) {
5
- var value = (0, number_array_1.randomNumberArray)([min, max], count);
5
+ var value = custom_1.Randex.numberArray([min, max], count);
6
6
  var uniqueResult = [];
7
7
  var _loop_1 = function (i) {
8
8
  var uniqueValue = value[i];
@@ -31,17 +31,17 @@ describe("randomNumberArray", function () {
31
31
  var min = 5;
32
32
  var max = 10;
33
33
  var count = max - min + 1;
34
- var value = (0, number_array_1.randomNumberArray)([min, max], count);
34
+ var value = custom_1.Randex.numberArray([min, max], count);
35
35
  expect(value.length).toBe(count);
36
36
  // max length limit
37
- value = (0, number_array_1.randomNumberArray)([min, max], count + 10);
37
+ value = custom_1.Randex.numberArray([min, max], count + 10);
38
38
  expect(value.length).toBe(count);
39
39
  });
40
40
  it("range: fill all possible values", function () {
41
41
  var min = 5;
42
42
  var max = 10;
43
43
  var count = max - min + 1;
44
- var value = (0, number_array_1.randomNumberArray)([min, max], count);
44
+ var value = custom_1.Randex.numberArray([min, max], count);
45
45
  expect(value.length).toBe(count);
46
46
  var _loop_2 = function (i) {
47
47
  expect(value.find(function (x) { return x === i; })).toBeTruthy();
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var number_1 = require("../custom/number");
3
+ var custom_1 = require("../custom");
4
4
  var test_util_1 = require("./test-util");
5
5
  function testNumber(max) {
6
- var value = (0, number_1.randomNumber)(max);
6
+ var value = custom_1.Randex.number(max);
7
7
  expect(value).toBeGreaterThanOrEqual(0);
8
8
  expect(value).toBeLessThanOrEqual(max);
9
9
  }
10
10
  function testNumberWithArray(range, two) {
11
11
  if (two === void 0) { two = false; }
12
12
  var min = range[0], max = range[1];
13
- var value = two ? (0, number_1.randomNumber)(range) : (0, number_1.randomNumber)(min, max);
13
+ var value = two ? custom_1.Randex.number(range) : custom_1.Randex.number(min, max);
14
14
  expect(value).toBeGreaterThanOrEqual(min);
15
15
  expect(value).toBeLessThanOrEqual(max);
16
16
  }
@@ -24,7 +24,7 @@ describe("randomNumber", function () {
24
24
  var max = 4;
25
25
  var result = {};
26
26
  test_util_1.TestUtil.loop(function () {
27
- var value = (0, number_1.randomNumber)(max);
27
+ var value = custom_1.Randex.number(max);
28
28
  result[value] = (result[value] || 0) + 1;
29
29
  });
30
30
  for (var i = 0; i <= max; i++) {
@@ -44,7 +44,7 @@ describe("randomNumber", function () {
44
44
  it("two numbers with decimals", function () {
45
45
  var count = 0;
46
46
  test_util_1.TestUtil.loop(function () {
47
- var value = (0, number_1.randomNumber)(1, 10, { decimals: 2 });
47
+ var value = custom_1.Randex.number(1, 10, { decimals: 2 });
48
48
  if (/\.\d{2}$/g.test(value.toString())) {
49
49
  count++;
50
50
  }
@@ -54,7 +54,7 @@ describe("randomNumber", function () {
54
54
  it("a number with decimals", function () {
55
55
  var count = 0;
56
56
  test_util_1.TestUtil.loop(function () {
57
- var value = (0, number_1.randomNumber)(10, { decimals: 2 });
57
+ var value = custom_1.Randex.number(10, { decimals: 2 });
58
58
  if (/\.\d{2}$/g.test(value.toString())) {
59
59
  count++;
60
60
  }
@@ -1,51 +1,51 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var basic_1 = require("../basic");
4
3
  var test_util_1 = require("./test-util");
4
+ var custom_1 = require("../custom");
5
5
  describe("random params", function () {
6
6
  it("array 1", function () {
7
7
  var set = "english";
8
- var result1 = (0, basic_1.random)({ set: set });
9
- var result2 = (0, basic_1.random)(set);
8
+ var result1 = custom_1.Randex.random({ set: set });
9
+ var result2 = custom_1.Randex.random(set);
10
10
  test_util_1.TestUtil.testInSet(result1, set);
11
11
  test_util_1.TestUtil.testInSet(result2, set);
12
12
  });
13
13
  it("single: array", function () {
14
14
  var set = ["number", "english"];
15
- var result1 = (0, basic_1.random)({ set: set });
16
- var result2 = (0, basic_1.random)(set);
15
+ var result1 = custom_1.Randex.random({ set: set });
16
+ var result2 = custom_1.Randex.random(set);
17
17
  test_util_1.TestUtil.testInSet(result1, set);
18
18
  test_util_1.TestUtil.testInSet(result2, set);
19
19
  });
20
20
  it("single: array, length", function () {
21
21
  var set = ["number", "english"];
22
22
  var length = 3;
23
- var result1 = (0, basic_1.random)({ set: set, length: length });
24
- var result2 = (0, basic_1.random)([set, length]);
23
+ var result1 = custom_1.Randex.random({ set: set, length: length });
24
+ var result2 = custom_1.Randex.random([set, length]);
25
25
  test_util_1.TestUtil.testInSet(result1, set, length);
26
26
  test_util_1.TestUtil.testInSet(result2, set, length);
27
27
  });
28
28
  it("single: array, length as array", function () {
29
29
  var set = ["number", "english"];
30
30
  var length = [1, 4];
31
- var result1 = (0, basic_1.random)({ set: set, length: length });
32
- var result2 = (0, basic_1.random)([set, length]);
31
+ var result1 = custom_1.Randex.random({ set: set, length: length });
32
+ var result2 = custom_1.Randex.random([set, length]);
33
33
  test_util_1.TestUtil.testInSet(result1, set, length);
34
34
  test_util_1.TestUtil.testInSet(result2, set, length);
35
35
  });
36
36
  it("array 2 (range)", function () {
37
37
  var set = "number";
38
38
  var range = "abcdefghijklmnopqrstuvwxyz";
39
- var result1 = (0, basic_1.random)({ set: set, range: range });
40
- var result2 = (0, basic_1.random)([set, range]);
39
+ var result1 = custom_1.Randex.random({ set: set, range: range });
40
+ var result2 = custom_1.Randex.random([set, range]);
41
41
  test_util_1.TestUtil.testInBoth(result1, set, range);
42
42
  test_util_1.TestUtil.testInBoth(result2, set, range);
43
43
  });
44
44
  it("array 2 (length)", function () {
45
45
  var set = "english";
46
46
  var length = 3;
47
- var result1 = (0, basic_1.random)({ set: set, length: length });
48
- var result2 = (0, basic_1.random)([set, length]);
47
+ var result1 = custom_1.Randex.random({ set: set, length: length });
48
+ var result2 = custom_1.Randex.random([set, length]);
49
49
  test_util_1.TestUtil.testInSet(result1, set, length);
50
50
  test_util_1.TestUtil.testInSet(result2, set, length);
51
51
  });
@@ -53,8 +53,8 @@ describe("random params", function () {
53
53
  var set = "number";
54
54
  var range = "abcdefghijklmnopqrstuvwxyz";
55
55
  var length = 3;
56
- var result1 = (0, basic_1.random)({ set: set, range: range, length: length });
57
- var result2 = (0, basic_1.random)([set, range, length]);
56
+ var result1 = custom_1.Randex.random({ set: set, range: range, length: length });
57
+ var result2 = custom_1.Randex.random([set, range, length]);
58
58
  test_util_1.TestUtil.testInBoth(result1, set, range, length);
59
59
  test_util_1.TestUtil.testInBoth(result2, set, range, length);
60
60
  });
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var basic_1 = require("../basic");
4
3
  var test_util_1 = require("./test-util");
4
+ var custom_1 = require("../custom");
5
5
  function inSet(set, length) {
6
6
  if (length === void 0) { length = 1; }
7
- var result = (0, basic_1.random)({ set: set, length: length });
7
+ var result = custom_1.Randex.random({ set: set, length: length });
8
8
  test_util_1.TestUtil.testInSet(result, set, length);
9
9
  }
10
10
  function inRange(range, length) {
11
11
  if (length === void 0) { length = 1; }
12
- var result = (0, basic_1.random)({ range: range, length: length });
12
+ var result = custom_1.Randex.random({ range: range, length: length });
13
13
  test_util_1.TestUtil.testInRange(result, range, length);
14
14
  }
15
15
  describe("random", function () {
@@ -30,7 +30,7 @@ describe("random", function () {
30
30
  var length = [0, 4];
31
31
  var result = {};
32
32
  test_util_1.TestUtil.loop(function () {
33
- var l = (0, basic_1.random)({ set: "english", length: length }).length;
33
+ var l = custom_1.Randex.random({ set: "english", length: length }).length;
34
34
  result[l] = (result[l] || 0) + 1;
35
35
  });
36
36
  for (var i = 0; i <= 4; i++) {
@@ -41,7 +41,7 @@ describe("random", function () {
41
41
  var length = [5, 8];
42
42
  var result = {};
43
43
  test_util_1.TestUtil.loop(function () {
44
- var l = (0, basic_1.random)({ set: "english", length: length }).length;
44
+ var l = custom_1.Randex.random({ set: "english", length: length }).length;
45
45
  result[l] = (result[l] || 0) + 1;
46
46
  });
47
47
  for (var i = 5; i <= 8; i++) {
@@ -55,16 +55,16 @@ describe("random", function () {
55
55
  inSet("english", [0, 1]);
56
56
  });
57
57
  it("length: alphabet", function () {
58
- var value = (0, basic_1.random)("english");
58
+ var value = custom_1.Randex.random("english");
59
59
  expect(value.length).toBe(1);
60
- value = (0, basic_1.random)(["english", "l"]);
60
+ value = custom_1.Randex.random(["english", "l"]);
61
61
  expect(value.length).toBe(1);
62
62
  });
63
63
  it("alphabet: upper", function () {
64
64
  test_util_1.TestUtil.loop(function () {
65
- var value = (0, basic_1.random)(["english", "u"]);
65
+ var value = custom_1.Randex.random(["english", "u"]);
66
66
  expect(test_util_1.TestUtil.isUpperCharValid(value, 1)).toBeTruthy();
67
- value = (0, basic_1.random)([
67
+ value = custom_1.Randex.random([
68
68
  ["english", "u"],
69
69
  [1, 3],
70
70
  ]);
@@ -73,9 +73,9 @@ describe("random", function () {
73
73
  });
74
74
  it("alphabet: lower", function () {
75
75
  test_util_1.TestUtil.loop(function () {
76
- var value = (0, basic_1.random)(["english", "l"]);
76
+ var value = custom_1.Randex.random(["english", "l"]);
77
77
  expect(test_util_1.TestUtil.isLowerCharValid(value, 1)).toBeTruthy();
78
- value = (0, basic_1.random)([
78
+ value = custom_1.Randex.random([
79
79
  ["english", "lower"],
80
80
  [1, 3],
81
81
  ]);
@@ -1,28 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var username_1 = require("../custom/username");
3
+ var custom_1 = require("../custom");
4
4
  var test_util_1 = require("./test-util");
5
5
  describe("randomEmail", function () {
6
6
  it("simple", function () {
7
7
  test_util_1.TestUtil.loop(function () {
8
- var value = (0, username_1.randomUsername)();
8
+ var value = custom_1.Randex.username();
9
9
  expect(test_util_1.TestUtil.isUsernameValid(value)).toBeTruthy();
10
10
  });
11
11
  });
12
12
  it("options", function () {
13
- var value = (0, username_1.randomUsername)({ length: 5 });
13
+ var value = custom_1.Randex.username({ length: 5 });
14
14
  expect(value.length).toBe(5);
15
- value = (0, username_1.randomUsername)(5);
15
+ value = custom_1.Randex.username(5);
16
16
  expect(value.length).toBe(5);
17
17
  //
18
- value = (0, username_1.randomUsername)({ length: [5, 5] });
18
+ value = custom_1.Randex.username({ length: [5, 5] });
19
19
  expect(value.length).toBe(5);
20
- value = (0, username_1.randomUsername)([5, 5]);
20
+ value = custom_1.Randex.username([5, 5]);
21
21
  expect(value.length).toBe(5);
22
22
  //
23
- value = (0, username_1.randomUsername)({ length: [1, 5] });
23
+ value = custom_1.Randex.username({ length: [1, 5] });
24
24
  expect(test_util_1.TestUtil.inNumberRange(value.length, [1, 5])).toBeTruthy();
25
- value = (0, username_1.randomUsername)([1, 5]);
25
+ value = custom_1.Randex.username([1, 5]);
26
26
  expect(test_util_1.TestUtil.inNumberRange(value.length, [1, 5])).toBeTruthy();
27
27
  });
28
28
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "randex",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,2 +0,0 @@
1
- import { RandexContentOptions } from "../interfaces";
2
- export declare function random(...options: RandexContentOptions[]): string;