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

utility

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utility - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

5

History.md
0.0.4 / 2013-04-16
==================
* add accessLogDate()
0.0.3 / 2013-03-06

@@ -3,0 +8,0 @@ ==================

@@ -109,1 +109,15 @@ /*!

};
/**
* Access log format date. format: `moment().format('DD/MMM/YYYY:HH:mm:ss ZZ')`
*
* @return {String}
*/
exports.accessLogDate = function () {
// 0 1 2 3 4 5 6
// Tue Apr 16 2013 16:40:09 GMT+0800 (CST)
// =>
// 16/Apr/2013:16:40:09 +0800
var dates = new Date().toString().split(' ');
return dates[2] + '/' + dates[1] + '/' + dates[3] + ':' + dates[4] + ' ' + dates[5].substring(3);
};

2

package.json
{
"name": "utility",
"version": "0.0.3",
"version": "0.0.4",
"description": "A collection of useful utilities.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -45,4 +45,28 @@ utility [![Build Status](https://secure.travis-ci.org/fengmk2/utility.png)](http://travis-ci.org/fengmk2/utility)

utils.escape('<script/>"& &amp;'); // '&lt;script/&gt;&quot;&amp; &amp;'
// accessLogDate
utils.accessLogDate(); // '16/Apr/2013:16:40:09 +0800'
```
## accessLogDate() benchmark
[benchmark/date_format.js](https://github.com/fengmk2/fengmk2.github.com/blob/master/benchmark/date_format.js)
```bash
$ node benchmark/date_format.js
moment().format(): "16/Apr/2013:18:18:30 +0800"
new Date().toString(): "Tue Apr 16 2013 18:18:30 GMT+0800 (CST)"
Date(): "Tue Apr 16 2013 18:18:30 GMT+0800 (CST)"
fasterAccessDate(): "16/Apr/2013:18:18:30 +0800"
fasterAccessDate2(): "16/Apr/2013:18:18:30 +0800"
------------------------
moment().format('DD/MMM/YYYY:HH:mm:ss ZZ') x 78,364 ops/sec ±1.01% (99 runs sampled)
new Date().toString() x 837,714 ops/sec ±0.92% (95 runs sampled)
Date() x 777,068 ops/sec ±4.76% (90 runs sampled)
fasterAccessDate() x 337,151 ops/sec ±1.51% (95 runs sampled)
fasterAccessDate2() x 335,866 ops/sec ±2.27% (92 runs sampled)
Fastest is new Date().toString()
```
## License

@@ -49,0 +73,0 @@

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