Skip to content

Commit 3f362ae

Browse files
number_format
1 parent 6f4ccf8 commit 3f362ae

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/plugins/helper/number_format.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interface Options {
22
delimiter?: string;
33
separator?: string;
4-
precision?: number | string;
4+
precision?: number;
55
}
66

77
function numberFormatHelper(num: number, options: Options = {}) {
@@ -34,7 +34,7 @@ function numberFormatHelper(num: number, options: Options = {}) {
3434
const afterLast = after[precision];
3535
const last = parseInt(after[precision - 1], 10);
3636

37-
afterResult = after.substring(0, precision - 1) + (afterLast < 5 ? last : last + 1);
37+
afterResult = after.substring(0, precision - 1) + (Number(afterLast) < 5 ? last : last + 1);
3838
} else {
3939
afterResult = after;
4040
for (let i = 0, len = precision - afterLength; i < len; i++) {
@@ -43,7 +43,7 @@ function numberFormatHelper(num: number, options: Options = {}) {
4343
}
4444

4545
after = afterResult;
46-
} else if (precision === 0 || precision === '0') {
46+
} else if (precision === 0) {
4747
after = '';
4848
}
4949

lib/plugins/tag/include_code.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export = ctx => function includeCodeTag(args) {
6060

6161
return exists(src).then(exist => {
6262
if (exist) return readFile(src);
63-
}).then(code => {
63+
}).then((code: string) => {
6464
if (!code) return;
6565

6666
const lines = code.split('\n');

lib/theme/processors/source.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Pattern} from 'hexo-util';
2-
import common from '../../plugins/processor/common';
2+
import * as common from '../../plugins/processor/common';
33

44
export function process(file) {
55
const Asset = this.model('Asset');

0 commit comments

Comments
 (0)