1+ const { random, randomItem, pad, range, uppercaseify, include, } = require ( '../../api' ) ;
2+
13module . exports = ( inc , contents ) => {
2- var pic = contents . picture ;
4+ const pic = contents . picture ;
35 delete contents . picture ;
46
5- include ( inc , 'phone' , '0' + range ( 2 , 9 ) + '-' + random ( 3 , 3 ) + '-' + random ( 3 , 3 ) ) ;
6- include ( inc , 'cell' , '04' + range ( 0 , 9 ) + '-' + random ( 3 , 3 ) + '-' + random ( 3 , 2 ) + '-' + random ( 3 , 2 ) ) ;
7- include ( inc , 'id' , ( ) => {
8- var dob = contents . dob ;
9- var dobDate = new Date ( dob ) ;
10- var full_year = dobDate . getFullYear ( ) ;
7+ include ( inc , contents , 'phone' , '0' + range ( 2 , 9 ) + '-' + random ( 3 , 3 ) + '-' + random ( 3 , 3 ) ) ;
8+ include ( inc , contents , 'cell' , '04' + range ( 0 , 9 ) + '-' + random ( 3 , 3 ) + '-' + random ( 3 , 2 ) + '-' + random ( 3 , 2 ) ) ;
9+ include ( inc , contents , 'id' , ( ) => {
10+ const dob = contents . dob ;
11+ const dobDate = new Date ( dob ) ;
12+ const full_year = dobDate . getFullYear ( ) ;
1113
12- var day = dobDate . getDay ( ) ;
13- var month = dobDate . getMonth ( ) ;
14- var year = String ( full_year ) . substr ( 2 , 2 ) ;
14+ const day = dobDate . getDay ( ) ;
15+ const month = dobDate . getMonth ( ) ;
16+ const year = String ( full_year ) . substr ( 2 , 2 ) ;
1517
16- var century ;
18+ let century ;
1719 if ( full_year < 1900 ) {
1820 century = '+' ;
1921 } else if ( full_year >= 1900 && full_year < 2000 ) {
@@ -22,18 +24,18 @@ module.exports = (inc, contents) => {
2224 century = 'A' ;
2325 }
2426
25- var zzz = random ( 3 , 2 ) + ( contents . gender !== 'male' ? randomItem ( [ 0 , 2 , 4 , 6 , 8 ] ) : randomItem ( [ 1 , 3 , 5 , 7 , 9 ] ) ) ;
26- var checksum_str = '0123456789ABCDEFHJKLMNPRSTUVWXY' ;
27+ const zzz = random ( 3 , 2 ) + ( contents . gender !== 'male' ? randomItem ( [ 0 , 2 , 4 , 6 , 8 ] ) : randomItem ( [ 1 , 3 , 5 , 7 , 9 ] ) ) ;
28+ const checksum_str = '0123456789ABCDEFHJKLMNPRSTUVWXY' ;
2729
28- var cc = checksum_str [ ( day + month + year + zzz ) % 31 ] ;
30+ const cc = checksum_str [ ( day + month + year + zzz ) % 31 ] ;
2931
30- var hetu = day + month + year + century + zzz + cc ;
32+ const hetu = day + month + year + century + zzz + cc ;
3133
3234 contents . id = {
3335 name : 'HETU' ,
3436 value : hetu
3537 } ;
3638 } ) ;
3739
38- include ( inc , 'picture' , pic ) ;
39- } ;
40+ include ( inc , contents , 'picture' , pic ) ;
41+ } ;
0 commit comments