affinirum 1.3.1 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -126
- package/dst/Affinirum.d.ts +1 -1
- package/dst/Affinirum.js +43 -47
- package/dst/Constants.js +2 -0
- package/dst/ParserState.js +2 -2
- package/dst/atom/ArrayAtom.d.ts +3 -3
- package/dst/atom/ArrayAtom.js +14 -13
- package/dst/atom/FunctionAtom.d.ts +1 -1
- package/dst/atom/FunctionAtom.js +11 -9
- package/dst/atom/ObjectAtom.d.ts +3 -3
- package/dst/atom/ObjectAtom.js +14 -18
- package/dst/atom/PrimitiveAtom.js +3 -3
- package/dst/cjs/Affinirum.js +43 -47
- package/dst/cjs/Constants.js +2 -0
- package/dst/cjs/ParserState.js +2 -2
- package/dst/cjs/atom/ArrayAtom.js +14 -13
- package/dst/cjs/atom/FunctionAtom.js +11 -9
- package/dst/cjs/atom/ObjectAtom.js +14 -18
- package/dst/cjs/atom/PrimitiveAtom.js +3 -3
- package/dst/cjs/native/Boolean.js +5 -2
- package/dst/cjs/native/Buffer.js +43 -11
- package/dst/cjs/native/Float.js +2 -5
- package/dst/cjs/native/Integer.js +8 -5
- package/dst/cjs/native/String.js +32 -15
- package/dst/cjs/native/Timestamp.js +25 -11
- package/dst/cjs/native/Unknown.js +10 -10
- package/dst/cjs/native/notation/AN.js +4 -4
- package/dst/cjs/native/notation/IP.js +239 -0
- package/dst/cjs/native/notation/JSON.js +3 -3
- package/dst/cjs/node/ArrayNode.js +7 -3
- package/dst/cjs/node/{FunctionNode.js → CallNode.js} +5 -4
- package/dst/cjs/node/ObjectNode.js +4 -2
- package/dst/native/Boolean.js +5 -2
- package/dst/native/Buffer.d.ts +3 -1
- package/dst/native/Buffer.js +41 -10
- package/dst/native/Float.d.ts +1 -1
- package/dst/native/Float.js +2 -5
- package/dst/native/Integer.d.ts +1 -1
- package/dst/native/Integer.js +8 -5
- package/dst/native/String.d.ts +2 -2
- package/dst/native/String.js +32 -15
- package/dst/native/Timestamp.d.ts +3 -3
- package/dst/native/Timestamp.js +25 -11
- package/dst/native/Unknown.js +11 -11
- package/dst/native/notation/AN.js +4 -4
- package/dst/native/notation/IP.d.ts +6 -0
- package/dst/native/notation/IP.js +236 -0
- package/dst/native/notation/JSON.js +3 -3
- package/dst/node/ArrayNode.d.ts +2 -1
- package/dst/node/ArrayNode.js +7 -3
- package/dst/node/{FunctionNode.d.ts → CallNode.d.ts} +1 -1
- package/dst/node/{FunctionNode.js → CallNode.js} +3 -2
- package/dst/node/ObjectNode.d.ts +1 -1
- package/dst/node/ObjectNode.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,24 +76,28 @@ Whitespace characters are ignored.
|
|
|
76
76
|
- **array** for ordered sequences of values
|
|
77
77
|
- **object** for collections of named values
|
|
78
78
|
- **function** for built-in, injected or script-defined subroutines
|
|
79
|
-
|
|
80
|
-
Type
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Unknown or variant type is declared as **??**.
|
|
79
|
+
- **??** for unknown or variant type
|
|
80
|
+
- Type grouping: **(...)**
|
|
81
|
+
- Type union: **|**
|
|
82
|
+
- Type optionality modifier: **?**
|
|
84
83
|
|
|
85
84
|
### Definitions
|
|
86
|
-
- Value grouping: **(...)**
|
|
87
85
|
- Unit grouping: **{...}**
|
|
88
|
-
-
|
|
86
|
+
- Unit separator: **;**
|
|
87
|
+
- Value grouping: **(...)**
|
|
88
|
+
- Value separator: **,**
|
|
89
89
|
- Array element at numeric index, or object property by string key: **[]**
|
|
90
90
|
- Object property by string key or method function call: **.**
|
|
91
91
|
- Array definiton: **[item1, ...]**
|
|
92
92
|
- Object definition: **[propery1-key: property1-value, ...]**
|
|
93
|
-
- Subroutine definition: **~
|
|
93
|
+
- Subroutine definition: **~(argument1-name: argument1-type, ...):return-type {...}**
|
|
94
94
|
- Conditional switch definition, returns first or second value if prefix is true or false: **if condition {value1} else {value2}**,
|
|
95
|
-
and if **else** clause is ommited second value deemed null
|
|
95
|
+
and if **else** clause is ommited second value deemed *null*
|
|
96
96
|
- Loop definition, iteratively evaluates suffix while prefix is true, returns last evaluated value: **while condition {...}**
|
|
97
|
+
- Stop iteration: **stop**
|
|
98
|
+
- Proceed to next iteration: **next**
|
|
99
|
+
- Function return operator: **~>value**
|
|
100
|
+
- Execution exit operator: **=>value**
|
|
97
101
|
|
|
98
102
|
### Operators
|
|
99
103
|
- Boolean negation (Logical NOT): **!**
|
|
@@ -112,8 +116,8 @@ Unknown or variant type is declared as **??**.
|
|
|
112
116
|
- Arithmetic division: **/**
|
|
113
117
|
- Arithmetic remainder: **%**
|
|
114
118
|
- Exponentiation operator: **^**
|
|
115
|
-
-
|
|
116
|
-
-
|
|
119
|
+
- Property access operator: **.**
|
|
120
|
+
- Property existance operator: **?**
|
|
117
121
|
- Assignment: **=**
|
|
118
122
|
- Boolean disjunction (Logical OR) assignment: **|=**
|
|
119
123
|
- Boolean conjunction (Logical AND) assignment: **&=**
|
|
@@ -123,166 +127,210 @@ Unknown or variant type is declared as **??**.
|
|
|
123
127
|
- Arithmetic division assignment: **/=**
|
|
124
128
|
- Arithmetic remainder assignment: **%=**
|
|
125
129
|
|
|
126
|
-
###
|
|
130
|
+
### Native Global Functions
|
|
131
|
+
|
|
132
|
+
Native conversions use the following null handling:
|
|
133
|
+
|
|
134
|
+
- `Format` returns an empty string for a **null**.
|
|
135
|
+
- `Encode` returns a zero-length buffer for a **null**.
|
|
136
|
+
- `Decode` and `Parse` return **null** when their input value is **null**.
|
|
137
|
+
|
|
138
|
+
Empty strings and zero-length buffers remain ordinary values; they are not serialized null markers.
|
|
139
|
+
Invalid non-null inputs are function-specific and may raise an evaluation error.
|
|
127
140
|
|
|
128
141
|
#### Boolean
|
|
129
|
-
- **
|
|
130
|
-
- **
|
|
131
|
-
- **
|
|
132
|
-
- **
|
|
133
|
-
- **
|
|
142
|
+
- **Boolean.Or(values: ...(boolean | array)):boolean** — Boolean disjunction of booleans and arrays of booleans
|
|
143
|
+
- **Boolean.And(values: ...(boolean | array)):boolean** — Boolean conjunction of booleans and arrays of booleans
|
|
144
|
+
- **Boolean.Not(value: boolean):boolean** — Boolean negation
|
|
145
|
+
- **Boolean.Decode(value: buffer?, offset: integer?):boolean?** — Decode a byte at the optional offset; missing or out-of-range input returns **void**
|
|
146
|
+
- **Boolean.Parse(value: string?):boolean?** — Parse case-insensitive `true` or `false`; other values return **void**
|
|
134
147
|
|
|
135
148
|
#### Timestamp
|
|
136
|
-
- **
|
|
137
|
-
- **
|
|
138
|
-
- **
|
|
139
|
-
- **
|
|
149
|
+
- **Timestamp.Now():timestamp** — Current date and time
|
|
150
|
+
- **Timestamp.Epoch(value: float | integer, epoch: timestamp?):timestamp** — Create timestamp from milliseconds
|
|
151
|
+
- **Timestamp.Decode(value: buffer?, encoding: string?, offset: integer?):timestamp?** — Decode a timestamp using `i64` (default) or `i64le`
|
|
152
|
+
- **Timestamp.Parse(value: string?):timestamp?** — Parse a string as a timestamp
|
|
140
153
|
|
|
141
154
|
#### Float
|
|
142
155
|
- **Float.NAN** — Not-a-number
|
|
143
156
|
- **Float.PositiveInfinity** — Positive infinity
|
|
144
157
|
- **Float.NegativeInfinity** — Negative infinity
|
|
145
158
|
- **Float.Epsilon** — Smallest positive float
|
|
146
|
-
- **
|
|
147
|
-
- **
|
|
148
|
-
- **
|
|
149
|
-
- **
|
|
150
|
-
- **
|
|
151
|
-
- **
|
|
152
|
-
- **
|
|
153
|
-
- **
|
|
154
|
-
- **
|
|
155
|
-
- **
|
|
156
|
-
- **
|
|
157
|
-
- **
|
|
158
|
-
- **
|
|
159
|
+
- **Float.Sum(values: ...(float | array)):float** — Numeric sum
|
|
160
|
+
- **Float.Min(values: ...(float | array)):float** — Numeric minimum
|
|
161
|
+
- **Float.Max(values: ...(float | array)):float** — Numeric maximum
|
|
162
|
+
- **Float.Exponent(value: float):float** — Natural exponential
|
|
163
|
+
- **Float.Logarithm(value: float):float** — Natural logarithm
|
|
164
|
+
- **Float.Abs(value: float):float** — Absolute value
|
|
165
|
+
- **Float.Ceil(value: float):float** — Smallest integer greater than or equal to the value
|
|
166
|
+
- **Float.Floor(value: float):float** — Largest integer less than or equal to the value
|
|
167
|
+
- **Float.Round(value: float):float** — Rounded value
|
|
168
|
+
- **Float.Truncate(value: float):float** — Integer portion of the value
|
|
169
|
+
- **Float.Random(exclusiveTo: float):float** — Random float up to value
|
|
170
|
+
- **Float.Decode(value: buffer?, encoding: string?, offset: integer?):float?** — Decode using `f64` (default), `f64le`, `f32`, or `f32le`
|
|
171
|
+
- **Float.Parse(value: string?):float?** — Parse a string as a float
|
|
159
172
|
|
|
160
173
|
#### Integer
|
|
161
|
-
- **
|
|
162
|
-
- **
|
|
163
|
-
- **
|
|
164
|
-
- **
|
|
165
|
-
- **
|
|
166
|
-
- **
|
|
174
|
+
- **Integer.Sum(values: ...(integer | array)):integer** — Numeric sum
|
|
175
|
+
- **Integer.Min(values: ...(integer | array)):integer** — Numeric minimum
|
|
176
|
+
- **Integer.Max(values: ...(integer | array)):integer** — Numeric maximum
|
|
177
|
+
- **Integer.Random(exclusiveTo: integer):integer** — Random integer up to value
|
|
178
|
+
- **Integer.Decode(value: buffer?, encoding: string?, offset: integer?):integer?** — Decode using signed `i8`, `i16`, `i16le`, `i32`, `i32le`, `i64` (default), or `i64le`, or unsigned `n8`, `n16`, `n16le`, `n32`, `n32le`, `n64`, or `n64le`
|
|
179
|
+
- **Integer.Parse(value: string?):integer?** — Parse a string as an integer
|
|
167
180
|
|
|
168
181
|
#### String
|
|
169
|
-
- **
|
|
170
|
-
- **
|
|
182
|
+
- **String.Alphanum(value: string):string** — Keep only ASCII letters and digits
|
|
183
|
+
- **String.Random(length: integer):string** — Random alphanumeric string
|
|
184
|
+
- **String.Decode(value: buffer?, encoding: string?, offset: integer?, length: integer?):string?** — Decode using `utf8` (default), `sbcs`, `ucs2`, or `ucs2le`
|
|
171
185
|
|
|
172
186
|
#### Buffer
|
|
173
|
-
- **
|
|
174
|
-
- **
|
|
187
|
+
- **Buffer.Random(length: integer):buffer** — Buffer of given length filled with random bytes
|
|
188
|
+
- **Buffer.Parse(value: string?):buffer?** — Parse a hexadecimal string as a buffer
|
|
175
189
|
|
|
176
190
|
#### Array
|
|
177
|
-
- **
|
|
178
|
-
- **
|
|
179
|
-
- **
|
|
180
|
-
- **
|
|
181
|
-
- **
|
|
191
|
+
- **Array.Join(values: ...array):array** — Join arrays of any depths into a single array
|
|
192
|
+
- **Array.Range(inclusiveFrom: integer, exclusiveTo: integer):array** — New array filled with integers in range
|
|
193
|
+
- **Array.Unique(value: array):array** — Array of unique values
|
|
194
|
+
- **Array.Intersection(a1: array, a2: array):array** — Common values from two arrays
|
|
195
|
+
- **Array.Difference(a1: array, a2: array):array** — Symmetrical difference between arrays
|
|
182
196
|
|
|
183
197
|
#### Object
|
|
184
|
-
- **
|
|
198
|
+
- **Object.Merge(values: ...(object | array)):object** — Merge objects and arrays of objects
|
|
185
199
|
|
|
186
200
|
#### AN
|
|
187
|
-
- **
|
|
201
|
+
- **AN.Format(value: ??, whitespace: string?):string** — Format a value as AN notation
|
|
188
202
|
|
|
189
203
|
#### JSON
|
|
190
|
-
- **
|
|
191
|
-
- **void | boolean | float | string | array | object
|
|
204
|
+
- **JSON.Format(value: (void | boolean | timestamp | float | integer | string | array | object), whitespace: string?):string** — Format a value as JSON
|
|
205
|
+
- **JSON.Parse(value: string?):(void | boolean | timestamp | float | integer | string | array | object)** — Parse a JSON-formatted string; standard JSON values are not revived as timestamps or integers
|
|
192
206
|
|
|
207
|
+
#### IP
|
|
208
|
+
- **IP.Match(values: array, search: ...(string | array)):boolean** — Check whether any searched IPv4 or IPv6 address belongs to the supplied addresses or CIDR ranges
|
|
209
|
+
- **IP.Encode(value: string?):buffer** — Encode an IPv4, IPv6, or CIDR string as a network-byte-order buffer; malformed or **void** input returns a zero-length buffer
|
|
210
|
+
- **IP.Decode(value: buffer?):string?** — Decode a 4-, 5-, 16-, or 17-byte buffer as canonical IPv4, IPv6, or CIDR notation; malformed or **void** input returns **void**
|
|
193
211
|
|
|
194
|
-
###
|
|
212
|
+
### Native Method Functions
|
|
195
213
|
|
|
196
214
|
#### General Functions
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
- **buffer
|
|
201
|
-
- **
|
|
215
|
+
- **??.Coalesce(otherwise: ??):??** — Null coalescence
|
|
216
|
+
- **??.Equal(value: ??):boolean** — Equals to
|
|
217
|
+
- **??.Unequal(value: ??):boolean** — Not equals to
|
|
218
|
+
- **(boolean | buffer | function).Encode():buffer** — Encode value to buffer
|
|
219
|
+
- **(void | timestamp | float | integer | string | array | object).Encode(encoding: string?):buffer** — Encode a value; defaults are `i64` for timestamps and integers, `f64` for floats, and `utf8` for strings
|
|
220
|
+
- **(boolean | string | function).Format():string** — Format value to string
|
|
221
|
+
- **(void | timestamp | float | integer | buffer | array | object).Format(formatting: string?):string** — Format a value; buffers use `hex` by default and also support `base64`
|
|
202
222
|
|
|
203
223
|
#### Aggregable Functions
|
|
204
|
-
- **float
|
|
224
|
+
- **float.Add(value: integer):float** — Add an integer
|
|
225
|
+
- **integer.Add(value: float):float** — Add a float
|
|
226
|
+
- **integer.Add(value: integer):integer** — Add an integer
|
|
227
|
+
- **buffer.Add(value: buffer):buffer** — Concatenate buffers
|
|
228
|
+
- **string.Add(value: string):string** — Concatenate strings
|
|
229
|
+
- **array.Add(value: array):array** — Concatenate arrays
|
|
205
230
|
|
|
206
231
|
#### Array Functions
|
|
207
|
-
-
|
|
208
|
-
-
|
|
209
|
-
- **
|
|
210
|
-
- **
|
|
211
|
-
- **
|
|
212
|
-
- **
|
|
213
|
-
- **array
|
|
214
|
-
- **array
|
|
215
|
-
- **array
|
|
216
|
-
- **array
|
|
217
|
-
-
|
|
218
|
-
- **
|
|
219
|
-
- **array
|
|
220
|
-
- **array
|
|
232
|
+
- **array.First(condition: function):??** — First item satisfying condition
|
|
233
|
+
- **array.Last(condition: function):??** — Last item satisfying condition
|
|
234
|
+
- **array.FirstIndex(condition: function):integer?** — First index satisfying condition, or **void** if none does
|
|
235
|
+
- **array.LastIndex(condition: function):integer?** — Last index satisfying condition, or **void** if none does
|
|
236
|
+
- **array.Every(condition: function):boolean** — All items satisfy condition
|
|
237
|
+
- **array.Any(condition: function):boolean** — Any item satisfies condition
|
|
238
|
+
- **array.Reverse():array** — Reversed array
|
|
239
|
+
- **array.Flatten(depth: integer = 1):array** — Flatten array
|
|
240
|
+
- **array.Derive(transformation: function):array** — Derived array
|
|
241
|
+
- **array.Filter(condition: function):array** — Filtered array
|
|
242
|
+
- **array.Reduce(reducer: function, initial: ?? = void):??** — Reduced value
|
|
243
|
+
- **array.Compose(generator: function):object** — Compose object from array
|
|
244
|
+
- **array.Prepend(items: ...??):array** — Prepend items
|
|
245
|
+
- **array.Append(items: ...??):array** — Append items
|
|
221
246
|
|
|
222
247
|
#### Buffer Functions
|
|
223
|
-
- **buffer
|
|
224
|
-
- **string Buffer.FormatBuffer(value: buffer)** — Hexadecimal string from buffer
|
|
248
|
+
- **buffer.Byte(pos: integer):buffer?** — Byte at position, or **void** when unavailable
|
|
225
249
|
|
|
226
250
|
#### Enumerable Functions
|
|
227
|
-
- **buffer
|
|
228
|
-
- **
|
|
229
|
-
- **
|
|
251
|
+
- **buffer.Slice(start: integer?, end: integer?):buffer** — Slice section
|
|
252
|
+
- **string.Slice(start: integer?, end: integer?):string** — Slice section
|
|
253
|
+
- **array.Slice(start: integer?, end: integer?):array** — Slice section
|
|
254
|
+
- **buffer.Splice(start: integer, remove: integer, inject: ...array):buffer** — Splice section
|
|
255
|
+
- **string.Splice(start: integer, remove: integer, inject: ...array):string** — Splice section
|
|
256
|
+
- **array.Splice(start: integer, remove: integer, inject: ...array):array** — Splice section
|
|
257
|
+
- **buffer.Inject(start: integer, inject: ...array):buffer** — Inject section
|
|
258
|
+
- **string.Inject(start: integer, inject: ...array):string** — Inject section
|
|
259
|
+
- **array.Inject(start: integer, inject: ...array):array** — Inject section
|
|
230
260
|
|
|
231
261
|
#### Iterable Functions
|
|
232
|
-
- **
|
|
233
|
-
- **
|
|
234
|
-
-
|
|
235
|
-
-
|
|
262
|
+
- **(buffer | string | array | object).Length():integer** — Get length
|
|
263
|
+
- **buffer.Contains(search: buffer, startPos: integer?):boolean** — Check if buffer contains another buffer
|
|
264
|
+
- **string.Contains(search: string, startPos: integer?, ignoreCaseSpaceEtc: boolean?):boolean** — Check if string contains another string
|
|
265
|
+
- **array.Contains(search: ??, startPos: integer?):boolean** — Check if array contains value
|
|
266
|
+
- **object.Contains(search: ??):boolean** — Check if object contains value
|
|
267
|
+
- **array.At(index: integer):??** — Access item in array by index
|
|
268
|
+
- **object.At(index: string):??** — Access item in object by key
|
|
269
|
+
- **array.Has(index: integer):boolean** — Identify if array has index
|
|
270
|
+
- **object.Has(index: string):boolean** — Identify if object has key
|
|
236
271
|
|
|
237
272
|
#### Number Functions
|
|
238
|
-
- **
|
|
239
|
-
- **
|
|
240
|
-
- **
|
|
241
|
-
- **
|
|
242
|
-
- **float
|
|
243
|
-
- **
|
|
244
|
-
- **float
|
|
245
|
-
- **
|
|
246
|
-
- **float
|
|
247
|
-
- **
|
|
248
|
-
- **
|
|
249
|
-
- **float
|
|
250
|
-
- **
|
|
251
|
-
- **float
|
|
252
|
-
- **integer
|
|
273
|
+
- **(float | integer).GreaterThan(value):boolean** — Greater than
|
|
274
|
+
- **(float | integer).LessThan(value):boolean** — Less than
|
|
275
|
+
- **(float | integer).GreaterOrEqual(value):boolean** — Greater or equal
|
|
276
|
+
- **(float | integer).LessOrEqual(value):boolean** — Less or equal
|
|
277
|
+
- **float.Subtract(subtrahend):float** — Subtract value
|
|
278
|
+
- **integer.Subtract(subtrahend):integer** — Subtract value
|
|
279
|
+
- **float.Negate():float** — Negate number
|
|
280
|
+
- **integer.Negate():integer** — Negate number
|
|
281
|
+
- **float.Multiply(value: integer):float** — Multiply by an integer
|
|
282
|
+
- **integer.Multiply(value: float):float** — Multiply by a float
|
|
283
|
+
- **integer.Multiply(value: integer):integer** — Multiply by an integer
|
|
284
|
+
- **float.Divide(divisor):float** — Divide value
|
|
285
|
+
- **integer.Divide(divisor):integer** — Divide value
|
|
286
|
+
- **float.Remainder(divisor):float** — Remainder
|
|
287
|
+
- **integer.Remainder(divisor):integer** — Remainder
|
|
288
|
+
- **float.Modulo(divisor):float** — Modulo
|
|
289
|
+
- **integer.Modulo(divisor):integer** — Modulo
|
|
290
|
+
- **float.Power(exponent):float** — Power
|
|
291
|
+
- **integer.Power(exponent):integer** — Power
|
|
292
|
+
- **float.Root(index):float** — Root
|
|
293
|
+
- **integer.Root(index):integer** — Root
|
|
294
|
+
- **float.Cast():integer** — Cast to integer
|
|
295
|
+
- **integer.Cast():float** — Cast to float
|
|
296
|
+
- **integer.CastToFloat():float** — Cast to float
|
|
297
|
+
- **float.CastToInteger():integer** — Cast to integer
|
|
253
298
|
|
|
254
299
|
#### Object Functions
|
|
255
|
-
- **
|
|
256
|
-
- **
|
|
257
|
-
- **
|
|
300
|
+
- **object.Entries():array** — Key-value pairs
|
|
301
|
+
- **object.Keys():array** — Object keys
|
|
302
|
+
- **object.Values():array** — Object values
|
|
258
303
|
|
|
259
304
|
#### String Functions
|
|
260
|
-
- **
|
|
261
|
-
- **
|
|
262
|
-
- **
|
|
263
|
-
- **
|
|
264
|
-
- **string
|
|
265
|
-
- **
|
|
266
|
-
- **string
|
|
267
|
-
- **string
|
|
268
|
-
- **string
|
|
269
|
-
- **string
|
|
270
|
-
- **string
|
|
271
|
-
- **string string
|
|
272
|
-
- **
|
|
273
|
-
- **string string.ReplaceWith(replacement: string, search: ...array)** — Replace all instances of substring with another
|
|
305
|
+
- **string.Like(value: string):boolean** — Alphanumeric equality
|
|
306
|
+
- **string.Unlike(value: string):boolean** — Alphanumeric inequality
|
|
307
|
+
- **string.StartsWith(search: string, startPos: integer?, ignoreCaseSpaceEtc: boolean?):boolean** — Prefix check
|
|
308
|
+
- **string.EndsWith(search: string, endPos: integer?, ignoreCaseSpaceEtc: boolean?):boolean** — Suffix check
|
|
309
|
+
- **string.Char(pos: integer):string** — Character at position
|
|
310
|
+
- **string.CharCode(pos: integer):integer** — Character code
|
|
311
|
+
- **string.Trim():string** — Trim whitespace
|
|
312
|
+
- **string.TrimStart():string** — Trim leading whitespace
|
|
313
|
+
- **string.TrimEnd():string** — Trim trailing whitespace
|
|
314
|
+
- **string.LowerCase():string** — To lowercase
|
|
315
|
+
- **string.UpperCase():string** — To uppercase
|
|
316
|
+
- **string.Split(separator: string = ' '):array** — Split into array
|
|
317
|
+
- **string.ReplaceWith(replacement: string, search: ...(string | array)):string** — Replace all instances of the searched strings
|
|
274
318
|
|
|
275
319
|
#### Timestamp Functions
|
|
276
|
-
- **
|
|
277
|
-
- **
|
|
278
|
-
- **
|
|
279
|
-
- **
|
|
280
|
-
- **
|
|
281
|
-
- **
|
|
282
|
-
- **
|
|
283
|
-
- **
|
|
284
|
-
- **
|
|
285
|
-
- **
|
|
320
|
+
- **timestamp.Year(utc: boolean?):integer** — Get year
|
|
321
|
+
- **timestamp.Month(utc: boolean?):integer** — Get month
|
|
322
|
+
- **timestamp.MonthIndex(utc: boolean?):integer** — Month index
|
|
323
|
+
- **timestamp.WeekdayIndex(utc: boolean?):integer** — Weekday index
|
|
324
|
+
- **timestamp.Day(utc: boolean?):integer** — Day of month
|
|
325
|
+
- **timestamp.Hour(utc: boolean?):integer** — Hour
|
|
326
|
+
- **timestamp.Minute(utc: boolean?):integer** — Minute
|
|
327
|
+
- **timestamp.Second(utc: boolean?):integer** — Second
|
|
328
|
+
- **timestamp.Millisecond(utc: boolean?):integer** — Millisecond
|
|
329
|
+
- **timestamp.EpochTime(epoch: timestamp?):integer** — Milliseconds since epoch or 1970-01-01 00:00:00 UTC
|
|
330
|
+
- **timestamp.DaysSince(value: timestamp):float** — Difference from another timestamp in days
|
|
331
|
+
- **timestamp.HoursSince(value: timestamp):float** — Difference from another timestamp in hours
|
|
332
|
+
- **timestamp.MinutesSince(value: timestamp):float** — Difference from another timestamp in minutes
|
|
333
|
+
- **timestamp.SecondsSince(value: timestamp):float** — Difference from another timestamp in seconds
|
|
286
334
|
|
|
287
335
|
## Reference
|
|
288
336
|
|
|
@@ -306,7 +354,7 @@ const objExpr = new Affinirum( '[`prop1`:a,`prop2`:`abc`].prop1+10' );
|
|
|
306
354
|
const oValue = objExpr.evaluate( { a: 50 } ); // 60
|
|
307
355
|
...
|
|
308
356
|
const iteratorExpr = new Affinirum(
|
|
309
|
-
'Float.Sum(arr1.Derive(
|
|
357
|
+
'Float.Sum(arr1.Derive(~(a:float):float{a*2}).Filter(~(a:float):boolean{a>3}))'
|
|
310
358
|
);
|
|
311
359
|
const iValue = iteratorExpr.evaluate( { arr1: [ 1, 2, 3 ] } ); // 10
|
|
312
360
|
...
|
package/dst/Affinirum.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare class Affinirum {
|
|
|
13
13
|
protected readonly _script: string;
|
|
14
14
|
protected readonly _strict: boolean;
|
|
15
15
|
protected readonly _root: Node;
|
|
16
|
-
protected readonly
|
|
16
|
+
protected readonly _varframes: Map<string, ParserFrame>;
|
|
17
17
|
protected readonly _variables: Map<string, Variable>;
|
|
18
18
|
protected readonly _constants: Map<string, Record<string, Constant>>;
|
|
19
19
|
protected readonly _functions: Map<string, Constant>;
|