-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor using typescript (#60)
BREAKING CHANGE: drop Node.js < 16 support
- Loading branch information
Showing
90 changed files
with
2,472 additions
and
4,222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": [ | ||
"eslint-config-egg/typescript", | ||
"eslint-config-egg/lib/rules/enforce-node-prefix" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,5 @@ npm-debug.log | |
.DS_Store | ||
.idea | ||
.nyc_output | ||
.tshy* | ||
dist |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const Benchmark = require('benchmark'); | ||
const benchmarks = require('beautify-benchmark'); | ||
const utility = require('../'); | ||
const moment = require('moment'); | ||
|
||
const suite = new Benchmark.Suite(); | ||
|
||
console.log(utility.YYYYMMDDHHmmss()); | ||
console.log(moment().format('YYYY-MM-DD HH:mm:ss')); | ||
|
||
// add tests | ||
suite | ||
|
||
.add('utility.YYYYMMDDHHmmss()', function() { | ||
utility.YYYYMMDDHHmmss(); | ||
}) | ||
.add("moment().format('YYYY-MM-DD HH:mm:ss')", function() { | ||
moment().format('YYYY-MM-DD HH:mm:ss'); | ||
}) | ||
|
||
// add listeners | ||
.on('cycle', function(event) { | ||
benchmarks.add(event.target); | ||
}) | ||
.on('start', function() { | ||
console.log('\n node version: %s, date: %s\n Starting...', process.version, Date()); | ||
}) | ||
.on('complete', function() { | ||
benchmarks.log(); | ||
}) | ||
// run async | ||
.run({ async: false }); | ||
|
||
// $ node benchmark/YYYYMMDDHHmmss.js | ||
// | ||
// 2014-06-19 12:37:15 | ||
// 2014-06-19 12:37:15 | ||
// | ||
// node version: v0.11.12, date: Thu Jun 19 2014 12:37:15 GMT+0800 (CST) | ||
// Starting... | ||
// 2 tests completed. | ||
// | ||
// utility.YYYYMMDDHHmmss() x 2,878,879 ops/sec ±2.44% (96 runs sampled) | ||
// moment().format('YYYY-MM-DD HH:mm:ss') x 138,521 ops/sec ±1.11% (96 runs sampled) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.