dry-ux 1.13.0 → 1.15.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.
@@ -2,3 +2,4 @@ export declare const preventDefault: (handler?: (event: any) => void) => (event:
2
2
  export declare const importScript: (resourceUrl: string, singleton?: boolean) => Promise<void>;
3
3
  export declare const importStyleSheet: (resourceUrl: string) => void;
4
4
  export declare const useCountdown: (seconds: number, onExpiry: () => void) => number;
5
+ export declare const formatDollar: (amount: number, decimal_places?: boolean) => string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useCountdown = exports.importStyleSheet = exports.importScript = exports.preventDefault = void 0;
3
+ exports.formatDollar = exports.useCountdown = exports.importStyleSheet = exports.importScript = exports.preventDefault = void 0;
4
4
  const React = require("react");
5
5
  const preventDefault = (handler) => {
6
6
  return (event) => {
@@ -52,3 +52,17 @@ const useCountdown = (seconds, onExpiry) => {
52
52
  return secondsRemaining;
53
53
  };
54
54
  exports.useCountdown = useCountdown;
55
+ const formatDollar = (amount, decimal_places) => {
56
+ const p = amount.toFixed(2).split(".");
57
+ let result = p[0]
58
+ .split("")
59
+ .reverse()
60
+ .reduce(function (acc, num, i, orig) {
61
+ return num + (i && !(i % 3) ? "," : "") + acc;
62
+ }, "");
63
+ if (decimal_places) {
64
+ result += "." + p[1];
65
+ }
66
+ return result;
67
+ };
68
+ exports.formatDollar = formatDollar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dry-ux",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
4
4
  "description": "",
5
5
  "main": "dist/index",
6
6
  "scripts": {