@nka212bg/backend-utils 0.1.30 → 0.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/misc.js +3 -3
  2. package/package.json +1 -1
package/misc.js CHANGED
@@ -86,11 +86,11 @@ exports.createToken = ({ length = 14, type } = {}) => {
86
86
  const nums = "1234567890";
87
87
 
88
88
  if (type == "number") return mixer(nums, length);
89
- if (type == "date") return mixer(chars, 1) + mixer(nums + chars + nums, length - 7) + parseInt(Date.now() / 100000000) + mixer(chars, 1);
90
- return mixer(chars, 1) + mixer(nums + chars + nums, length - 2) + mixer(chars, 1);
89
+ if (type == "date") return mixer(chars, Math.max(length - 6, 4)) + parseInt(Date.now() / 10000000);
90
+ return mixer(chars, 1) + mixer(nums + chars, length - 2) + mixer(chars, 1);
91
91
 
92
92
  function mixer(string, length) {
93
- if (string.length > length) string = string + string;
93
+ while (string.length < length) string += string;
94
94
 
95
95
  return string
96
96
  .split("")
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nka212bg/backend-utils",
3
3
  "author": "nka212bg",
4
- "version": "0.1.30",
4
+ "version": "0.1.31",
5
5
  "main": "index.js",
6
6
  "dependencies": {
7
7
  "@maxmind/geoip2-node": "^5.0.0",