diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2019-12-20 02:09:51 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2019-12-20 02:09:51 +0900 |
| commit | 1eb557806374373a682d0d0a192ac9f09007ef85 (patch) | |
| tree | 57044a8d5001f0317f2ad5e7a9bed97b23467a99 /src/misc/aiscript | |
| parent | Media Proxy を実装 (#5649) (diff) | |
| download | misskey-1eb557806374373a682d0d0a192ac9f09007ef85.tar.gz misskey-1eb557806374373a682d0d0a192ac9f09007ef85.tar.bz2 misskey-1eb557806374373a682d0d0a192ac9f09007ef85.zip | |
Add round function
Diffstat (limited to 'src/misc/aiscript')
| -rw-r--r-- | src/misc/aiscript/evaluator.ts | 1 | ||||
| -rw-r--r-- | src/misc/aiscript/index.ts | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/misc/aiscript/evaluator.ts b/src/misc/aiscript/evaluator.ts index f6165afb64..857de13083 100644 --- a/src/misc/aiscript/evaluator.ts +++ b/src/misc/aiscript/evaluator.ts @@ -162,6 +162,7 @@ export class ASEvaluator { multiply: (a: number, b: number) => a * b, divide: (a: number, b: number) => a / b, mod: (a: number, b: number) => a % b, + round: (a: number) => Math.round(a), strLen: (a: string) => a.length, strPick: (a: string, b: number) => a[b - 1], strReplace: (a: string, b: string, c: string) => a.split(b).join(c), diff --git a/src/misc/aiscript/index.ts b/src/misc/aiscript/index.ts index 3a21e9b1cc..f2de1bb40d 100644 --- a/src/misc/aiscript/index.ts +++ b/src/misc/aiscript/index.ts @@ -24,6 +24,7 @@ import { faExchangeAlt, faRecycle, faIndent, + faCalculator, } from '@fortawesome/free-solid-svg-icons'; import { faFlag } from '@fortawesome/free-regular-svg-icons'; @@ -59,6 +60,7 @@ export const funcDefs: Record<string, { in: any[]; out: any; category: string; i multiply: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faTimes, }, divide: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faDivide, }, mod: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faDivide, }, + round: { in: ['number'], out: 'number', category: 'operation', icon: faCalculator, }, eq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faEquals, }, notEq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faNotEqual, }, gt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThan, }, |