Skip to content

Commit

Permalink
feat(core): add bigint support (#1410)
Browse files Browse the repository at this point in the history
  • Loading branch information
yhx-12243 authored Jun 4, 2024
1 parent d985a51 commit 5f1610e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/core/src/command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ export class Commander {
throw new Error('internal.invalid-natural')
}, { numeric: true })

this.domain('bigint', (source, session) => {
try {
return BigInt(source)
} catch {
throw new Error("internal.invalid-integer")

Check failure on line 197 in packages/core/src/command/index.ts

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote
}
}, { numeric: true })

this.domain('date', (source, session) => {
const timestamp = Time.parseDate(source)
if (+timestamp) return timestamp
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/command/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export namespace Argv {
integer: number
posint: number
natural: number
bigint: bigint
date: Date
img: JSX.IntrinsicElements['img']
image: JSX.IntrinsicElements['img']
Expand Down

0 comments on commit 5f1610e

Please sign in to comment.