-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy pathfaker.js
More file actions
27 lines (23 loc) · 742 Bytes
/
faker.js
File metadata and controls
27 lines (23 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* Copyright IBM Corp. 2015, 2025
* SPDX-License-Identifier: BUSL-1.1
*/
import faker from 'faker';
import config from 'nomad-ui/config/environment';
const searchIncludesSeed = window.location.search.includes('faker-seed');
if (config.environment !== 'test' || searchIncludesSeed) {
if (searchIncludesSeed) {
const params = new URLSearchParams(window.location.search);
const seed = parseInt(params.get('faker-seed'));
faker.seed(seed);
} else {
faker.seed(1);
}
} else if (config.environment === 'test') {
const randomSeed = faker.random.number();
console.log(
`No seed specified with faker-seed query parameter, seeding Faker with ${randomSeed}`
);
faker.seed(randomSeed);
}
export default faker;