-
Notifications
You must be signed in to change notification settings - Fork 288
Expand file tree
/
Copy pathinject.js
More file actions
25 lines (21 loc) · 1.13 KB
/
inject.js
File metadata and controls
25 lines (21 loc) · 1.13 KB
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
const {random, randomItem, pad, range, uppercaseify, include,} = require('../../api');
module.exports = (inc, contents) => {
const pic = contents.picture;
delete contents.picture;
include(inc, contents, 'location', () => {
contents.location.postcode = range(1000, 9999);
});
let landlinePrefix = ['22', '23', '24', '25', '26', '27', '28', '29', '32',
'33', '34', '35', '36', '37', '42', '44', '45', '46', '47', '48', '49',
'52', '53', '54', '56', '57', '58', '59', '62', '63', '66', '68', '69',
'72', '73', '74', '75', '76', '77', '78', '79', '82', '83', '84', '85',
'87', '88', '89', '92', '93', '94', '95', '96', '99'];
let mobilePrefix = ['20', '30', '31', '50', '70'];
include(inc, contents, 'phone', `(${randomItem(landlinePrefix)} ${random(3, 2)}) ${random(3, 3)} ${random(3, 3)}`);
include(inc, contents, 'cell', `${randomItem(mobilePrefix)} ${random(3, 2)} ${random(3, 3)} ${random(3, 3)}`);
include(inc, contents, 'id', {
name: 'TAJ',
value: `${random(3, 3)} ${random(3, 3)} ${random(3, 3)}}`
});
include(inc, contents, 'picture', pic);
};