@claritylabs/cl-sdk 0.14.1 → 0.14.2

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/dist/index.mjs CHANGED
@@ -1912,6 +1912,9 @@ function synthesizeDeductibles(doc) {
1912
1912
  }
1913
1913
  var PREMIUM_PATTERNS = ["premium", "totalPremium", "annualPremium", "policyPremium", "basePremium"];
1914
1914
  var TOTAL_COST_PATTERNS = ["totalCost", "totalDue", "totalAmount", "totalPolicyPremium"];
1915
+ function absorbNegative(value) {
1916
+ return value.replace(/^-\s*/, "").replace(/^\(\s*(.*?)\s*\)$/, "$1");
1917
+ }
1915
1918
  function promotePremium(doc) {
1916
1919
  const raw = doc;
1917
1920
  const fields = getDeclarationFields(doc);
@@ -1923,6 +1926,8 @@ function promotePremium(doc) {
1923
1926
  const totalCost = findFieldValue(fields, TOTAL_COST_PATTERNS);
1924
1927
  if (totalCost) raw.totalCost = totalCost;
1925
1928
  }
1929
+ if (typeof raw.premium === "string") raw.premium = absorbNegative(raw.premium);
1930
+ if (typeof raw.totalCost === "string") raw.totalCost = absorbNegative(raw.totalCost);
1926
1931
  }
1927
1932
  function promoteExtractedFields(doc) {
1928
1933
  promoteCarrierFields(doc);