How to use the mac_address function from chance

Find comprehensive JavaScript chance.mac_address code examples handpicked from public code repositorys.

168
169
170
171
172
173
174
175
176
177
async.series([
  function (cb) {
    test.app.post('/data/ip_data')
      .set('Content-Type', 'application/json')
      .send(data = {
        'macaddr_data': chance.mac_address().toLowerCase(),
        'ip_data': chance.ip() + '/32',
        'host_data': chance.ip()
      })
      .expect(200, [data])
fork icon2
star icon5
watch icon4

9
10
11
12
13
14
15
16
17
18
function Device() {
    this.clientId = chance.hash({ length: 8 });
    this.lifetime = chance.integer({ min: 600, max: 86400 });
    this.joinTime = chance.timestamp();
    this.ip = chance.ip();
    this.mac = chance.mac_address();
    this.version = rdm.randomVersion();
    this.objList = {
        1: [ 0 ],
        3: [ 0 ],
fork icon1
star icon5
watch icon6

+ 5 other calls in file

103
104
105
106
107
108
109
110
111
112
Total mac address : 1

Mac address      Vlan  Type      Port                  Vc                      
            
-------------------------------------------------------------------------------
${mac_address_original || chance.mac_address()}   2516   Dynamic   vport-${f_p_s}.${ont_id}:1:1                 
IRARA-OLT#`
  if (chunkMA && chunkMA !== '') {
    const [_line1, _line2, _line3, _line4, ...splitted] = chunkMA.split('\n')
    element = (splitted && (splitted[3] || '').substring(0, 19).trim()) || ''
fork icon0
star icon1
watch icon1