Skip to content

Commit

Permalink
补一下 integer
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Jul 24, 2024
1 parent 1cf6a43 commit 7076bb1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/editorTable/excel/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ const as = {
number: (defaultValue?: number) => {
return new AsRule<number>(parseFloat).default(defaultValue);
},
/**
* 将值视为整数
*/
integer: (defaultValue?: number) => {
return new AsRule<number>(parseInt).default(defaultValue);
},
/**
* 将值视为字符串。
* @param value 值
Expand Down Expand Up @@ -176,6 +182,12 @@ const reader = {
number: (title: string, defaultValue?: number) => {
return new ReaderRule<number>((row) => parseFloat(row[title])).default(defaultValue);
},
/**
* 将值视为整数。
*/
integer: (title: string, defaultValue?: number) => {
return new ReaderRule<number>((row) => parseInt(row[title])).default(defaultValue);
},
/**
* 将值视为布尔值。
* @param title 列标题
Expand Down

0 comments on commit 7076bb1

Please sign in to comment.