Skip to content

Commit

Permalink
number_format
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Nov 25, 2022
1 parent 6f4ccf8 commit 3f362ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/plugins/helper/number_format.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interface Options {
delimiter?: string;
separator?: string;
precision?: number | string;
precision?: number;
}

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

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

after = afterResult;
} else if (precision === 0 || precision === '0') {
} else if (precision === 0) {
after = '';
}

Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/tag/include_code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export = ctx => function includeCodeTag(args) {

return exists(src).then(exist => {
if (exist) return readFile(src);
}).then(code => {
}).then((code: string) => {
if (!code) return;

const lines = code.split('\n');
Expand Down
2 changes: 1 addition & 1 deletion lib/theme/processors/source.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Pattern} from 'hexo-util';
import common from '../../plugins/processor/common';
import * as common from '../../plugins/processor/common';

export function process(file) {
const Asset = this.model('Asset');
Expand Down

0 comments on commit 3f362ae

Please sign in to comment.