pacc 6.8.0 → 6.9.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": "6.8.0",
3
+ "version": "6.9.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "ava": "^6.4.1",
42
- "browser-ava": "^2.3.49",
42
+ "browser-ava": "^2.3.50",
43
43
  "c8": "^10.1.3",
44
44
  "documentation": "^14.0.3",
45
45
  "semantic-release": "^25.0.2",
package/src/expand.mjs CHANGED
@@ -41,7 +41,7 @@ export function expand(object, context = {}) {
41
41
 
42
42
  let value = parse(expression, context);
43
43
  if (value === undefined) {
44
- result += object.substring(start, end + leadOut.length);
44
+ result += object.substring(cur, end + leadOut.length);
45
45
  } else {
46
46
  if (typeof value === "string") {
47
47
  value = _expand(value, path);
@@ -60,7 +60,8 @@ export function expand(object, context = {}) {
60
60
  cur = end + leadOut.length;
61
61
  } else {
62
62
  throw new Error(
63
- `Unterminated expression between '${leadIn}' and '${leadOut}'`
63
+ `Unterminated expression between '${leadIn}' and '${leadOut}'`,
64
+ { cause: object }
64
65
  );
65
66
  }
66
67
  }
@@ -312,10 +312,13 @@ export const globals = {
312
312
  }
313
313
  return false;
314
314
  },
315
- min: (a, b) => (a < b ? a : b),
316
- max: (a, b) => (a > b ? a : b),
317
- uppercase: (a) => a.toUpperCase(),
318
- lowercase: (a) => a.toLowerCase(),
315
+ ceil: Math.ceil,
316
+ floor: Math.floor,
317
+ abs: Math.abs,
318
+ min: Math.min,
319
+ max: Math.max,
320
+ uppercase: a => a.toUpperCase(),
321
+ lowercase: a => a.toLowerCase(),
319
322
  substring: (s, a, b) => s.substring(a, b),
320
323
  length: s => s.length
321
324
  };
@@ -2,8 +2,11 @@ export function binop(op: any, left: any, right: any, fallback: any): any;
2
2
  export function parse(input: any, context?: {
3
3
  globals: {
4
4
  in: (a: any, b: any) => boolean;
5
- min: (a: any, b: any) => any;
6
- max: (a: any, b: any) => any;
5
+ ceil: (x: number) => number;
6
+ floor: (x: number) => number;
7
+ abs: (x: number) => number;
8
+ min: (...values: number[]) => number;
9
+ max: (...values: number[]) => number;
7
10
  uppercase: (a: any) => any;
8
11
  lowercase: (a: any) => any;
9
12
  substring: (s: any, a: any, b: any) => any;
@@ -13,8 +16,11 @@ export function parse(input: any, context?: {
13
16
  export namespace globals {
14
17
  export function _in(a: any, b: any): boolean;
15
18
  export { _in as in };
16
- export function min(a: any, b: any): any;
17
- export function max(a: any, b: any): any;
19
+ export let ceil: (x: number) => number;
20
+ export let floor: (x: number) => number;
21
+ export let abs: (x: number) => number;
22
+ export let min: (...values: number[]) => number;
23
+ export let max: (...values: number[]) => number;
18
24
  export function uppercase(a: any): any;
19
25
  export function lowercase(a: any): any;
20
26
  export function substring(s: any, a: any, b: any): any;