@ancon/wildcat-utils 1.18.6 → 1.18.8

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.
@@ -1 +1 @@
1
- "use strict";const a=require("@ancon/wildcat-types"),u=require("../currency/getFormattedCurrency.js");require("../currency/getFormattedCurrencyPostfix.js");function y(e,t){return t?e-t>0?e-t:t:e}function M(e){return e.reduce((i,s)=>{const{modification:p,name:o,freeAmount:f,quantity:c,cost:n,replacementName:m,totalCost:d}=s;switch(p){case a.ModificationType.Remove:i.removed.push(o);break;case a.ModificationType.Replace:{const r=`${o} → ${m} (${u(d.amount,d.currency)})`;i.replaced.push(r);break}default:{const r=y(c,f),l=`${c}x ${o} (${r}x ${u(n.amount,n.currency)})`;i.added.push(l)}}return i},{added:[],removed:[],replaced:[]})}module.exports=M;
1
+ "use strict";const u=require("@ancon/wildcat-types"),s=require("../currency/getFormattedCurrency.js");require("../currency/getFormattedCurrencyPostfix.js");function y(e,t){return t?e-t>0?e-t:0:e}function M(e,t,i,r){const n=`${t}x ${e}`,o=y(t,i);if(o){const c=`(${o}x ${s(r.amount,r.currency)})`;return`${n} ${c}`}return n}function $(e){return e.reduce((i,r)=>{const{modification:n,name:o,freeAmount:c,quantity:f,cost:p,replacementName:m,totalCost:a}=r;switch(n){case u.ModificationType.Remove:i.removed.push(o);break;case u.ModificationType.Replace:{const d=`${o} → ${m} (${s(a.amount,a.currency)})`;i.replaced.push(d);break}default:{const d=M(o,f,c,p);i.added.push(d)}}return i},{added:[],removed:[],replaced:[]})}module.exports=$;
@@ -1,39 +1,52 @@
1
- import { ModificationType as c } from "@ancon/wildcat-types";
2
- import u from "../currency/getFormattedCurrency.mjs";
1
+ import { ModificationType as u } from "@ancon/wildcat-types";
2
+ import f from "../currency/getFormattedCurrency.mjs";
3
3
  import "../currency/getFormattedCurrencyPostfix.mjs";
4
- function M(e, t) {
5
- return t ? e - t > 0 ? e - t : t : e;
4
+ function $(t, e) {
5
+ return e ? t - e > 0 ? t - e : 0 : t;
6
6
  }
7
- function x(e) {
8
- return e.reduce(
9
- (o, s) => {
7
+ function l(t, e, o, r) {
8
+ const n = `${e}x ${t}`, i = $(e, o);
9
+ if (i) {
10
+ const d = `(${i}x ${f(
11
+ r.amount,
12
+ r.currency
13
+ )})`;
14
+ return `${n} ${d}`;
15
+ }
16
+ return n;
17
+ }
18
+ function x(t) {
19
+ return t.reduce(
20
+ (o, r) => {
10
21
  const {
11
- modification: p,
22
+ modification: n,
12
23
  name: i,
13
- freeAmount: m,
14
- quantity: n,
15
- cost: a,
16
- replacementName: f,
17
- totalCost: d
18
- } = s;
19
- switch (p) {
20
- case c.Remove:
24
+ freeAmount: d,
25
+ quantity: s,
26
+ cost: m,
27
+ replacementName: p,
28
+ totalCost: c
29
+ } = r;
30
+ switch (n) {
31
+ case u.Remove:
21
32
  o.removed.push(i);
22
33
  break;
23
- case c.Replace: {
24
- const r = `${i} → ${f} (${u(
25
- d.amount,
26
- d.currency
34
+ case u.Replace: {
35
+ const a = `${i} → ${p} (${f(
36
+ c.amount,
37
+ c.currency
27
38
  )})`;
28
- o.replaced.push(r);
39
+ o.replaced.push(a);
29
40
  break;
30
41
  }
31
42
  default: {
32
- const r = M(n, m), l = `${n}x ${i} (${r}x ${u(
33
- a.amount,
34
- a.currency
35
- )})`;
36
- o.added.push(l);
43
+ const a = l(
44
+ i,
45
+ s,
46
+ d,
47
+ m
48
+ );
49
+ o.added.push(a);
37
50
  }
38
51
  }
39
52
  return o;
@@ -1 +1 @@
1
- "use strict";function o(m=0){if(m>1e3){const u=m/1e3;return Number.isInteger(u)?`${m} m`:`${m.toFixed(2)} km`}return Number.isInteger(m)?`${m} m`:`${m.toFixed(2)} m`}module.exports=o;
1
+ "use strict";function m(t=0){if(t>1e3){const e=t/1e3;return Number.isInteger(e)?`${e} km`:`${e.toFixed(2)} km`}return Number.isInteger(t)?`${t} m`:`${t.toFixed(2)} m`}module.exports=m;
@@ -1,10 +1,10 @@
1
- function o(m = 0) {
2
- if (m > 1e3) {
3
- const u = m / 1e3;
4
- return Number.isInteger(u) ? `${m} m` : `${m.toFixed(2)} km`;
1
+ function m(t = 0) {
2
+ if (t > 1e3) {
3
+ const e = t / 1e3;
4
+ return Number.isInteger(e) ? `${e} km` : `${e.toFixed(2)} km`;
5
5
  }
6
- return Number.isInteger(m) ? `${m} m` : `${m.toFixed(2)} m`;
6
+ return Number.isInteger(t) ? `${t} m` : `${t.toFixed(2)} m`;
7
7
  }
8
8
  export {
9
- o as default
9
+ m as default
10
10
  };
@@ -1,7 +1,7 @@
1
- import { OrderFormat, OutletLisItem } from '@ancon/wildcat-types';
1
+ import { OrderFormat, OutletListItem } from '@ancon/wildcat-types';
2
2
  /**
3
3
  * Get outlet's available order formats - included pre-order formats
4
4
  * @param outlet Outlet list item
5
5
  * @returns Array of OrderFormat
6
6
  */
7
- export default function getOutletOrderFormats(outlet: OutletLisItem): OrderFormat[];
7
+ export default function getOutletOrderFormats(outlet: OutletListItem): OrderFormat[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.18.6",
3
+ "version": "1.18.8",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",