forked from hotoo/pinyin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refact(code style): update code styles
- Loading branch information
Showing
13 changed files
with
250 additions
and
250 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
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 |
---|---|---|
|
@@ -26,5 +26,5 @@ module.exports = { | |
"ǜ": "v4", | ||
"ń": "n2", | ||
"ň": "n3", | ||
"": "m2" | ||
"": "m2", | ||
}; |
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
Large diffs are not rendered by default.
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
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 |
---|---|---|
@@ -1,55 +1,55 @@ | ||
|
||
var memory = process.memoryUsage().rss; | ||
var Benchmark = require('benchmark'); | ||
var pinyin = require('../'); | ||
var Benchmark = require("benchmark"); | ||
var pinyin = require("../"); | ||
|
||
var pkg = require('../package.json'); | ||
console.log(pkg.name + '@' + pkg.version); | ||
var pkg = require("../package.json"); | ||
console.log(pkg.name + "@" + pkg.version); | ||
|
||
function formatNunber(num){ | ||
return String(num).replace(/(\d)(?=(\d{3})+$)/g, '$1,') | ||
return String(num).replace(/(\d)(?=(\d{3})+$)/g, "$1,"); | ||
} | ||
|
||
var suite = new Benchmark.Suite(); | ||
|
||
suite.add('pinyin 中文', function(){ | ||
return pinyin('中文'); | ||
suite.add("pinyin 中文", function(){ | ||
return pinyin("中文"); | ||
}) | ||
.add('pinyin --heteronym 中文', function(){ | ||
return pinyin('中文', { | ||
.add("pinyin --heteronym 中文", function(){ | ||
return pinyin("中文", { | ||
heteronym: true, | ||
}); | ||
}) | ||
.add('pinyin --style NORMAL --heteronym 中文', function(){ | ||
return pinyin('中文', { | ||
.add("pinyin --style NORMAL --heteronym 中文", function(){ | ||
return pinyin("中文", { | ||
heteronym: true, | ||
style: 'NORMAL', | ||
style: "NORMAL", | ||
}); | ||
}) | ||
.add('pinyin --segment 中文', function(){ | ||
return pinyin('中文', { | ||
.add("pinyin --segment 中文", function(){ | ||
return pinyin("中文", { | ||
segment: true, | ||
}); | ||
}) | ||
.add('pinyin --segment --heteronym 中文', function(){ | ||
return pinyin('中文', { | ||
.add("pinyin --segment --heteronym 中文", function(){ | ||
return pinyin("中文", { | ||
heteronym: true, | ||
segment: true, | ||
}); | ||
}) | ||
.add('pinyin --segment --heteronym --style NORMAL 中文', function(){ | ||
return pinyin('中文', { | ||
.add("pinyin --segment --heteronym --style NORMAL 中文", function(){ | ||
return pinyin("中文", { | ||
heteronym: true, | ||
segment: true, | ||
style: 'NORMAL', | ||
style: "NORMAL", | ||
}); | ||
}) | ||
.on('cycle', function(event) { | ||
.on("cycle", function(event) { | ||
var mem = process.memoryUsage().rss; | ||
console.log(String(event.target) + ' memory usage: %s bytes.', formatNunber(mem - memory)); | ||
console.log(String(event.target) + " memory usage: %s bytes.", formatNunber(mem - memory)); | ||
memory = mem; | ||
}) | ||
.on('complete', function() { | ||
console.log('Fastest is ' + this.filter('fastest').pluck('name')); | ||
.on("complete", function() { | ||
console.log("Fastest is " + this.filter("fastest").pluck("name")); | ||
}) | ||
.run(); |
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
Oops, something went wrong.