@archerjessop/utilities 2.6.0 → 2.7.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.
@@ -0,0 +1,2 @@
1
+ const formatInputDisplay=(t,r)=>{const n=parseFloat(t)||0,i=n%1!=0;switch(r){case"currency":return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:i?2:0,maximumFractionDigits:2}).format(n);case"percent":return new Intl.NumberFormat("en-US",{minimumFractionDigits:i&&Math.abs(n)>=.1?1:i?3:0,maximumFractionDigits:Math.abs(n)<1?3:2}).format(n)+"%";case"years":return new Intl.NumberFormat("en-US",{minimumFractionDigits:i?1:0,maximumFractionDigits:1}).format(n)+" yrs.";case"months":return new Intl.NumberFormat("en-US",{minimumFractionDigits:0,maximumFractionDigits:0}).format(n)+" mos.";case"number":return new Intl.NumberFormat("en-US",{minimumFractionDigits:i?2:0,maximumFractionDigits:2}).format(n);default:return t}},parseNumericInput=t=>{if(null==t)return 0;const r=t.toString().replace(/[^0-9.-]/g,"");return parseFloat(r)||0};export{formatInputDisplay,parseNumericInput};
2
+ //# sourceMappingURL=financial-formatting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"financial-formatting.js","sources":["../../src/formatting/financial-formatting.js"],"sourcesContent":["// Enhanced formatting for input fields\r\nexport const formatInputDisplay = (value, type) => {\r\n const num = parseFloat(value) || 0;\r\n const hasDecimals = num % 1 !== 0;\r\n \r\n switch (type) {\r\n case \"currency\":\r\n return new Intl.NumberFormat(\"en-US\", {\r\n style: \"currency\",\r\n currency: \"USD\",\r\n minimumFractionDigits: hasDecimals ? 2 : 0,\r\n maximumFractionDigits: 2\r\n }).format(num);\r\n \r\n case \"percent\":\r\n return new Intl.NumberFormat(\"en-US\", {\r\n minimumFractionDigits: hasDecimals && Math.abs(num) >= 0.1 ? 1 : hasDecimals ? 3 : 0,\r\n maximumFractionDigits: Math.abs(num) < 1 ? 3 : 2\r\n }).format(num) + \"%\";\r\n \r\n case \"years\":\r\n return new Intl.NumberFormat(\"en-US\", {\r\n minimumFractionDigits: hasDecimals ? 1 : 0,\r\n maximumFractionDigits: 1\r\n }).format(num) + \" yrs.\";\r\n \r\n case \"months\":\r\n return new Intl.NumberFormat(\"en-US\", {\r\n minimumFractionDigits: 0,\r\n maximumFractionDigits: 0\r\n }).format(num) + \" mos.\";\r\n \r\n case \"number\":\r\n return new Intl.NumberFormat(\"en-US\", {\r\n minimumFractionDigits: hasDecimals ? 2 : 0,\r\n maximumFractionDigits: 2\r\n }).format(num);\r\n \r\n default:\r\n return value;\r\n }\r\n};\r\n\r\nexport const parseNumericInput = (value) => {\r\n // Handle null, undefined, or non-string inputs\r\n if (value === null || value === undefined) {\r\n return 0;\r\n }\r\n \r\n // Remove all non-numeric characters except decimal point and negative sign\r\n const cleaned = value.toString().replace(/[^0-9.-]/g, \"\");\r\n return parseFloat(cleaned) || 0;\r\n};"],"names":["formatInputDisplay","value","type","num","parseFloat","hasDecimals","Intl","NumberFormat","style","currency","minimumFractionDigits","maximumFractionDigits","format","Math","abs","parseNumericInput","cleaned","toString","replace"],"mappings":"AACY,MAACA,mBAAqB,CAACC,EAAOC,KACxC,MAAMC,EAAMC,WAAWH,IAAU,EAC3BI,EAAcF,EAAM,GAAM,EAEhC,OAAQD,GACN,IAAK,WACH,OAAO,IAAII,KAAKC,aAAa,QAAS,CACpCC,MAAO,WACPC,SAAU,MACVC,sBAAuBL,EAAc,EAAI,EACzCM,sBAAuB,IACtBC,OAAOT,GAEZ,IAAK,UACH,OAAO,IAAIG,KAAKC,aAAa,QAAS,CACpCG,sBAAuBL,GAAeQ,KAAKC,IAAIX,IAAQ,GAAM,EAAIE,EAAc,EAAI,EACnFM,sBAAuBE,KAAKC,IAAIX,GAAO,EAAI,EAAI,IAC9CS,OAAOT,GAAO,IAEnB,IAAK,QACH,OAAO,IAAIG,KAAKC,aAAa,QAAS,CACpCG,sBAAuBL,EAAc,EAAI,EACzCM,sBAAuB,IACtBC,OAAOT,GAAO,QAEnB,IAAK,SACH,OAAO,IAAIG,KAAKC,aAAa,QAAS,CACpCG,sBAAuB,EACvBC,sBAAuB,IACtBC,OAAOT,GAAO,QAEnB,IAAK,SACH,OAAO,IAAIG,KAAKC,aAAa,QAAS,CACpCG,sBAAuBL,EAAc,EAAI,EACzCM,sBAAuB,IACtBC,OAAOT,GAEZ,QACE,OAAOF,IAIAc,kBAAqBd,IAEhC,GAAIA,QACF,OAAO,EAIT,MAAMe,EAAUf,EAAMgB,WAAWC,QAAQ,YAAa,IACtD,OAAOd,WAAWY,IAAY"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export{calculateAppreciatedValue,calculateAssignmentFee,calculateBalloonBalance,calculateCOCR30,calculateCOCRAtPercent,calculateCashFlow,calculateCashFlowYield,calculateCashOutAfterRefi,calculateDscrPayment,calculateJvPayment,calculateNOIByType,calculateNetToBuyer,calculatePMT,calculatePriceForCOCR}from"./financial/calculations.js";export{formatCurrency,formatPercentage,formatPriceValue}from"./financial/formatters.js";export{extractBedrooms,extractPhoneNumber}from"./data/extractors.js";export{calculateDOM}from"./date/utilities.js";export{CALCULATION_TOLERANCE,DEFAULT_CAP_RATE,DEFAULT_DOWN_PAYMENT,DEFAULT_DSCR_PERCENTAGE,DSCR_AMORTIZATION,DSCR_INTEREST_RATE,FINANCIAL_CONSTANTS,MAX_ITERATIONS,SELLER_FI_AMORTIZATION,SELLER_FI_CARRY,SELLER_FI_DOWN_PAYMENT,SELLER_FI_INTEREST_RATE}from"./config/financial.js";export{ASSISTED_LIVING,MULTIFAMILY,PROPERTY_TYPES,PROPERTY_TYPE_CONSTANTS,STR}from"./config/property-types.js";export{ASSIGNMENT_FEE_PERCENTAGE,BUSINESS_CONSTANTS,BUYER_AGENT_COMMISSION,CLOSING_COSTS_PERCENTAGE,CONSERVATIVE_COCR15_PRICE_MULTIPLIER,FINANCING_FEE_PERCENTAGE,MAX_COCR15_PRICE_MULTIPLIER,MINIMUM_COCR15_PRICE,NET_TO_BUYER_PERCENTAGE,SELLER_AGENT_COMMISSION}from"./config/business.js";
1
+ export{calculateAppreciatedValue,calculateAssignmentFee,calculateBalloonBalance,calculateCOCR30,calculateCOCRAtPercent,calculateCashFlow,calculateCashFlowYield,calculateCashOutAfterRefi,calculateDscrPayment,calculateJvPayment,calculateNOIByType,calculateNetToBuyer,calculatePMT,calculatePriceForCOCR}from"./financial/calculations.js";export{formatCurrency,formatPercentage,formatPriceValue}from"./financial/formatters.js";export{extractBedrooms,extractPhoneNumber}from"./data/extractors.js";export{calculateDOM}from"./date/utilities.js";export{formatInputDisplay,parseNumericInput}from"./formatting/financial-formatting.js";export{CALCULATION_TOLERANCE,DEFAULT_CAP_RATE,DEFAULT_DOWN_PAYMENT,DEFAULT_DSCR_PERCENTAGE,DSCR_AMORTIZATION,DSCR_INTEREST_RATE,FINANCIAL_CONSTANTS,MAX_ITERATIONS,SELLER_FI_AMORTIZATION,SELLER_FI_CARRY,SELLER_FI_DOWN_PAYMENT,SELLER_FI_INTEREST_RATE}from"./config/financial.js";export{ASSISTED_LIVING,MULTIFAMILY,PROPERTY_TYPES,PROPERTY_TYPE_CONSTANTS,STR}from"./config/property-types.js";export{ASSIGNMENT_FEE_PERCENTAGE,BUSINESS_CONSTANTS,BUYER_AGENT_COMMISSION,CLOSING_COSTS_PERCENTAGE,CONSERVATIVE_COCR15_PRICE_MULTIPLIER,FINANCING_FEE_PERCENTAGE,MAX_COCR15_PRICE_MULTIPLIER,MINIMUM_COCR15_PRICE,NET_TO_BUYER_PERCENTAGE,SELLER_AGENT_COMMISSION}from"./config/business.js";
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archerjessop/utilities",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Shared utilities for ArcherJessop property analysis tools",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",