Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fable

Package Overview
Dependencies
Maintainers
0
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fable - npm Package Compare versions

Comparing version 3.0.146 to 3.0.147

2

package.json
{
"name": "fable",
"version": "3.0.146",
"version": "3.0.147",
"description": "A service dependency injection, configuration and logging library.",

@@ -5,0 +5,0 @@ "main": "source/Fable.js",

@@ -313,3 +313,23 @@ /**

return false;
}
}
/**
* Generate a safe string to use in filenames for a date. Useful for log file uniqueness and temporary outputs.
*
* @static
* @param {Date} pDate - An optional javascript Date object to generate a datestamp for.
* @returns {string} - A string formatted as YYYY-MM-DD-HH-MM-SS
*/
static generateFileNameDateStamp(pDate)
{
const tmpDate = pDate || new Date();
const tmpYear = tmpDate.getFullYear();
const tmpMonth = String(tmpDate.getMonth() + 1).padStart(2, '0');
const tmpDay = String(tmpDate.getDate()).padStart(2, '0');
const tmpHour = String(tmpDate.getHours()).padStart(2, '0');
const tmpMinute = String(tmpDate.getMinutes()).padStart(2, '0');
const tmpSecond = String(tmpDate.getSeconds()).padStart(2, '0');
return `${tmpYear}-${tmpMonth}-${tmpDay}-${tmpHour}-${tmpMinute}-${tmpSecond}`;
}
}

@@ -316,0 +336,0 @@

@@ -71,2 +71,13 @@ /**

(
'The static date stamp should work.',
function()
{
let tmpDateStamp = libFable.generateFileNameDateStamp();
Expect(tmpDateStamp).to.be.a('string');
Expect(tmpDateStamp.length).to.equal(19);
Expect(tmpDateStamp).to.match(/^\d{4}-\d{2}-\d{2}-\d{2}-\d{2}-\d{2}$/);
}
);
test
(
'Logging should happen...',

@@ -73,0 +84,0 @@ function(fDone)

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