1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var dw_analyzer_1 = require("@antv/dw-analyzer");
|
4 | var dw_random_1 = require("@antv/dw-random");
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | function oneMoreValue(sample) {
|
11 | var dataProps = dw_analyzer_1.type(sample);
|
12 | var isUnique = dataProps.count === dataProps.distinct;
|
13 | var tr = new dw_random_1.TextRandom();
|
14 | var r = new dw_random_1.Random();
|
15 | if (dataProps.recommendation === 'string') {
|
16 | if (isUnique) {
|
17 |
|
18 | return tr.word({ length: r.n(r.natural, 1, { min: dataProps.minLength, max: dataProps.maxLength })[0] });
|
19 | }
|
20 | else {
|
21 | return dataProps.samples[Math.floor(Math.random() * dataProps.samples.length)];
|
22 | }
|
23 | }
|
24 | else {
|
25 | return dataProps.samples[Math.floor(Math.random() * dataProps.samples.length)];
|
26 | }
|
27 | }
|
28 | exports.oneMoreValue = oneMoreValue;
|