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

console-timestamp

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-timestamp - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

10

console-timestamp.js

@@ -43,5 +43,13 @@ /**

out = out.replace("YY", date.getFullYear().toString().slice(-2), "g");
out = out.replace("MM", fixDigits(date.getMonth(), 2), "g");
out = out.replace("MM", fixDigits(date.getMonth()+1, 2), "g");
out = out.replace("DD", fixDigits(date.getDate(), 2), "g");
return out;
};
Object.defineProperty(String.prototype, 'timestamp', {
get: function () {
return module.exports(this);
}
});

2

package.json
{
"name": "console-timestamp",
"version": "0.2.1",
"version": "0.3.0",
"description": "Simple date formatter for logging purposes",

@@ -5,0 +5,0 @@ "main": "console-timestamp.js",

@@ -6,4 +6,6 @@ console-timestamp

There's only one function.
There's one function and one String property included.
**Timestamp function**
```timestamp([format, time]);```

@@ -22,2 +24,6 @@

**String getter**
Now, you can use a new String getter ```'hh:mm:ss'.timestamp``` which will replace placeholders in the string. You can't specify a date then. The values are automatically set to current time. It's just a shortcut for the regular function.
Examples

@@ -32,2 +38,4 @@ =================

console.log('hh:mm:ss'.timestamp); //13:58:29
console.log('DD-MM-YY hh:mm'.timestamp); //28-03-14 14:43
console.log(timestamp()); //15:43:20

@@ -34,0 +42,0 @@ console.log(timestamp('DD-MM-YYYY hh:mm:ss:iii')); //04-07-2014 14:32:45:891

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