module.exports.generate = function generate() {
  return firstPart() + '-' + secondPart() + '-' + thirdPart();
};

function randomComponent(length, max) {
  let padding = '';
  let component = '';
  while (padding.length < length) {
    padding += '0';
  }

  do {
    component = (padding + Math.floor(Math.random()*max)).substr(length * -1);
  } while (component === padding);

  return component;
}

function firstPart() {
  let part;
  do {
    part = randomComponent(3, 900);
  } while (part === '666');
  return part;
}

function secondPart() {
  return randomComponent(2, 100);
}

function thirdPart() {
  return randomComponent(4, 10000);
}

@@ -158,104 +158,18 @@
 let 
-padding = '';%0A  let component = '';%0A  while (padding.length %3C length) %7B%0A    padding += '0';%0A  %7D%0A
+component;
 %0A  d
@@ -191,19 +191,8 @@
 nt =
- (padding +
  Mat
@@ -216,34 +216,15 @@
 om()
-*
+ * 
 max)
-).substr(length * -1)
 ;%0A  
@@ -250,15 +250,9 @@
 === 
-padding
+0
 );%0A%0A
@@ -269,16 +269,49 @@
 omponent
+.toString().padStart(length, '0')
 ;%0A%7D%0A%0Afun

Use padStart