pacc 4.26.0 → 4.27.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "4.26.0",
3
+ "version": "4.27.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -53,7 +53,7 @@ export function binop(op, left, right, fallback) {
53
53
  return fallback(op, left, right);
54
54
  }
55
55
 
56
- export function parse(input, context = {}) {
56
+ export function parse(input, context = { globals }) {
57
57
  input = tokens(input);
58
58
 
59
59
  let node, token, value;
@@ -289,3 +289,9 @@ export function parse(input, context = {}) {
289
289
 
290
290
  return result;
291
291
  }
292
+
293
+ export const globals = {
294
+ min: (a, b) => (a < b ? a : b),
295
+ max: (a, b) => (a > b ? a : b),
296
+ substring: (s,a,b) => s.substring(a,b)
297
+ };
@@ -1,2 +1,13 @@
1
1
  export function binop(op: any, left: any, right: any, fallback: any): any;
2
- export function parse(input: any, context?: {}): any;
2
+ export function parse(input: any, context?: {
3
+ globals: {
4
+ min: (a: any, b: any) => any;
5
+ max: (a: any, b: any) => any;
6
+ substring: (s: any, a: any, b: any) => any;
7
+ };
8
+ }): any;
9
+ export namespace globals {
10
+ function min(a: any, b: any): any;
11
+ function max(a: any, b: any): any;
12
+ function substring(s: any, a: any, b: any): any;
13
+ }