var ObjectId = require('mongodb').ObjectId;
var Hashids = require("hashids");
var moment = require("moment");


function codeGenerator(salt) {

    var salt = salt ? salt : new ObjectId().toString();

    var hashids = new Hashids(salt, 8, "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890");
    var now = moment();
    var begin = now.clone().startOf("month");
    var diff = now.diff(begin);
    var code = `${hashids.encode(diff)}`;
    return code;
};


module.exports = codeGenerator;
@@ -104,17 +104,33 @@
 ent%22);%0A%0A
-%0A
+module.exports = 
 function
@@ -134,25 +134,15 @@
 ion 
+(
 co
-deGenerator(sal
+ntex
 t) %7B
@@ -162,18 +162,24 @@
 t = 
-salt ? sal
+context ? contex
 t : 
@@ -437,16 +437,19 @@
 %0A   
+ //
  return 
 code
@@ -448,46 +448,30 @@
 urn 
-code;%0A%7D;%0A%0A%0Amodule.exports = codeGenerator;
+salt;%0A    return code;%0A%7D;%0A

update generatecode