forked from ARSBlue/ToolBox-4-Iris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JS.inc
24 lines (19 loc) · 972 Bytes
/
JS.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
ROUTINE arsblue.JS [Type=INC]
/// This include contains javascript extensions
///
/// ARSBlue ToolBox-4-Iris
/// Copyright © 2019 ARS Blue GmbH
/// http://www.ars-blue.at
/// since JSON (javascript object notation) is part of javascript, json include will be automatically loaded when javascript macros are loaded
#include arsblue.util.Json
/// javascript only supports 54-bit integer values
/// (see javascript Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER)
#define JSMININT -9007199254740991
#define JSMAXINT 9007199254740991
/// javascript timestamp
#define JSTimeStamp $TR($ZDT($NOW(),3,,3)," ","T")
/// javascript numeric check
#define ISJSNUMERIC(%num) $S('$$$ISNUMERIC(%num):$$$NO,(%num>$$$JSMAXINT)||(%num<$$$JSMININT):$$$NO,1:$$$YES)
/// get javascript value (string or numeric)
#define GETJSVALUE(%val) $S($$$ISJSNUMERIC(%val):+%val,1:""_%val)
#define GETJSVALUEQ(%val) $S($$$ISJSNUMERIC(%val):+%val,1:"'"_%val_"'")