New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

build-number-generator

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

build-number-generator - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

14

dist/index.js

@@ -8,5 +8,3 @@ 'use strict';

}
function pad3 (value) {
/* c8 ignore next */
return value > 99 ? `${value}` : value > 9 ? `0${value}` : `00${value}`

@@ -17,3 +15,2 @@ }

let build = getBuildStamp();
options || (options = {});

@@ -28,6 +25,4 @@ if (typeof options === 'string') {

}
return build
}
function getBuildStamp () {

@@ -38,5 +33,3 @@ const now = new Date();

const day = now.getDate();
// Count 2-minute intervals elapsed since midnight:(HH * 60 + MM) / 2
const counter = parseInt((now.getHours() * 60 + now.getMinutes()) / 2);
// Format the stamp as YYMMDDCCC
return `${pad2(year)}${pad2(month)}${pad2(day)}${pad3(counter)}`

@@ -50,3 +43,2 @@ }

}
const year = +parts[1];

@@ -59,3 +51,2 @@ const month = +parts[2];

}
return { year, month, day, counter }

@@ -75,12 +66,7 @@ }

let { year, month, day, counter } = splitBuildNumber(build);
// Convert the two-digit year to the full year
year += 2000;
// Prepare the month to be accepted by the Date constructor
month -= 1;
// Convert count of 2-minute intervals to minutes elapsed since midnight
counter *= 2;
const hours = parseInt(counter / 60);
const minutes = parseInt(counter % 60);
return new Date(year, month, day, hours, minutes)

@@ -87,0 +73,0 @@ }

@@ -10,5 +10,3 @@ (function (global, factory) {

}
function pad3 (value) {
/* c8 ignore next */
return value > 99 ? `${value}` : value > 9 ? `0${value}` : `00${value}`

@@ -19,3 +17,2 @@ }

let build = getBuildStamp();
options || (options = {});

@@ -30,6 +27,4 @@ if (typeof options === 'string') {

}
return build
}
function getBuildStamp () {

@@ -40,5 +35,3 @@ const now = new Date();

const day = now.getDate();
// Count 2-minute intervals elapsed since midnight:(HH * 60 + MM) / 2
const counter = parseInt((now.getHours() * 60 + now.getMinutes()) / 2);
// Format the stamp as YYMMDDCCC
return `${pad2(year)}${pad2(month)}${pad2(day)}${pad3(counter)}`

@@ -52,3 +45,2 @@ }

}
const year = +parts[1];

@@ -61,3 +53,2 @@ const month = +parts[2];

}
return { year, month, day, counter }

@@ -77,12 +68,7 @@ }

let { year, month, day, counter } = splitBuildNumber(build);
// Convert the two-digit year to the full year
year += 2000;
// Prepare the month to be accepted by the Date constructor
month -= 1;
// Convert count of 2-minute intervals to minutes elapsed since midnight
counter *= 2;
const hours = parseInt(counter / 60);
const minutes = parseInt(counter % 60);
return new Date(year, month, day, hours, minutes)

@@ -89,0 +75,0 @@ }

2

dist/index.umd.min.js

@@ -1,2 +0,2 @@

!function(b,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports):"function"==typeof define&&define.amd?define(["exports"],a):a((b="undefined"!=typeof globalThis?globalThis:b||self).buildnumgen={})}(this,function(a){"use strict";function c(a){return a>9?`${a}`:`0${a}`}function d(e){let a=/(\d{2})(\d{2})(\d{2})(\d{3})$/.exec(e.trim());if(!a)throw Error('Build number has to end with "YYMMDDCCC".');let d=+a[1],b=+a[2],c=+a[3],f=+a[4];if(!(d>=0&&b>=1&&b<=12&&c>=1&&c<=31))throw Error("Build number has to contain numbers formatting a date.");return{year:d,month:b,day:c,counter:f}}function b(e){let{year:b,month:c,day:f,counter:a}=d(e);b+=2e3,c-=1,a*=2;let g=parseInt(a/60),h=parseInt(a%60);return new Date(b,c,f,g,h)}a.format=function(a){"string"==typeof a&&(a=b(a));let d=a.toDateString(),e=a.getHours(),f=a.getMinutes();return`${d} ${c(e)}:${c(f)}`},a.generate=function(a){let b=function h(){var a;let b=new Date,d=b.getFullYear()%100,e=b.getMonth()+1,f=b.getDate(),g=parseInt((60*b.getHours()+b.getMinutes())/2);return`${c(d)}${c(e)}${c(f)}${(a=g)>99?`${a}`:a>9?`0${a}`:`00${a}`}`}();a||(a={}),"string"==typeof a&&(a={version:a});let d=a.version;if(d){let e=a.versionSeparator||".";b=d.trim()+e.trim()+b}return b},a.parse=b,a.validate=function(a){try{return d(a),!0}catch{return!1}},Object.defineProperty(a,"__esModule",{value:!0})})
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):b((a="undefined"!=typeof globalThis?globalThis:a||self).buildnumgen={})}(this,function(a){"use strict";function b(a){return a>9?`${a}`:`0${a}`}function c(a){let b=/(\d{2})(\d{2})(\d{2})(\d{3})$/.exec(a.trim());if(!b)throw Error('Build number has to end with "YYMMDDCCC".');let c=+b[1],d=+b[2],e=+b[3],f=+b[4];if(!(c>=0&&d>=1&&d<=12&&e>=1&&e<=31))throw Error("Build number has to contain numbers formatting a date.");return{year:c,month:d,day:e,counter:f}}function d(a){let{year:b,month:d,day:e,counter:f}=c(a);b+=2e3,d-=1,f*=2;let g=parseInt(f/60),h=parseInt(f%60);return new Date(b,d,e,g,h)}a.format=function(a){"string"==typeof a&&(a=d(a));let c=a.toDateString(),e=a.getHours(),f=a.getMinutes();return`${c} ${b(e)}:${b(f)}`},a.generate=function(a){let c=function a(){var c;let d=new Date,e=d.getFullYear()%100,f=d.getMonth()+1,g=d.getDate(),h=parseInt((60*d.getHours()+d.getMinutes())/2);return`${b(e)}${b(f)}${b(g)}${(c=h)>99?`${c}`:c>9?`0${c}`:`00${c}`}`}();a||(a={}),"string"==typeof a&&(a={version:a});let d=a.version;if(d){let e=a.versionSeparator||".";c=d.trim()+e.trim()+c}return c},a.parse=d,a.validate=function(a){try{return c(a),!0}catch{return!1}},Object.defineProperty(a,"__esModule",{value:!0})})
//# sourceMappingURL=index.umd.min.js.map
{
"name": "build-number-generator",
"description": "Generates a unique build number with a human-readable build time.",
"version": "2.0.1",
"version": "2.0.2",
"homepage": "https://github.com/prantlf/build-number-generator#readme",

@@ -83,4 +83,4 @@ "author": {

"rollup": "^2.75.6",
"rollup-plugin-esbuild-minify": "^1.0.4",
"rollup-plugin-swc-minify": "^1.0.2",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-swc-minify": "^1.0.3",
"sprintf-js": "^1.1.2",

@@ -87,0 +87,0 @@ "tehanu": "^1.0.1",

@@ -12,3 +12,3 @@ # build-number-generator

**Note**: If you use Node.js < 14.8, stay with the versions 1.x. The functionality of the command-line script and of the API is the same.
**Note**: If you use Node.js < 14.8, stay with the versions 1.x. The functionality of the command-line script and of the API is the same. Requirements on the browser didn't change.

@@ -15,0 +15,0 @@ ## Features

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc