@jobber/formatters 0.4.0 → 0.4.1-CLEANUPre-d77f09b.478

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.cjs ADDED
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ const global = {};
4
+ function getGlobal() {
5
+ if (typeof window !== "undefined") {
6
+ return window;
7
+ }
8
+ return global;
9
+ }
10
+ const glob = getGlobal();
11
+
12
+ const configOverrides = (glob.ATLANTIS_ENV || {}).config || {};
13
+ const config = Object.freeze(Object.assign({ defaultCurrency: "USD", errorNotifier(message, error) {
14
+ console.error(message, error);
15
+ } }, configOverrides));
16
+
17
+ function formatCurrency(amount, currency = config.defaultCurrency) {
18
+ return amount.toLocaleString("en", {
19
+ style: "currency",
20
+ currency: currency,
21
+ });
22
+ }
23
+
24
+ exports.config = config;
25
+ exports.formatCurrency = formatCurrency;
package/dist/index.mjs ADDED
@@ -0,0 +1,22 @@
1
+ const global = {};
2
+ function getGlobal() {
3
+ if (typeof window !== "undefined") {
4
+ return window;
5
+ }
6
+ return global;
7
+ }
8
+ const glob = getGlobal();
9
+
10
+ const configOverrides = (glob.ATLANTIS_ENV || {}).config || {};
11
+ const config = Object.freeze(Object.assign({ defaultCurrency: "USD", errorNotifier(message, error) {
12
+ console.error(message, error);
13
+ } }, configOverrides));
14
+
15
+ function formatCurrency(amount, currency = config.defaultCurrency) {
16
+ return amount.toLocaleString("en", {
17
+ style: "currency",
18
+ currency: currency,
19
+ });
20
+ }
21
+
22
+ export { config, formatCurrency };
package/package.json CHANGED
@@ -1,16 +1,24 @@
1
1
  {
2
2
  "name": "@jobber/formatters",
3
- "version": "0.4.0",
3
+ "version": "0.4.1-CLEANUPre-d77f09b.478+d77f09b78",
4
4
  "license": "MIT",
5
- "main": "./dist/index.js",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
6
7
  "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
7
15
  "scripts": {
8
- "build": "tsc --project . --skipLibCheck",
9
- "clean": "rm -rf dist/* tsconfig.tsbuildinfo",
16
+ "build": "rollup -c rollup.config.mjs",
17
+ "clean": "rm -rf dist tsconfig.*tsbuildinfo",
10
18
  "bootstrap": "npm run clean; npm run build"
11
19
  },
12
20
  "files": [
13
21
  "dist/*"
14
22
  ],
15
- "gitHead": "baec68accebefa70b2f1234d757473e67a713ced"
23
+ "gitHead": "d77f09b7803319aa2e55b5e548edd1c49231ef95"
16
24
  }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/config.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.config = void 0;
4
- const global_1 = require("./global");
5
- const configOverrides = (global_1.global.ATLANTIS_ENV || {}).config || {};
6
- exports.config = Object.freeze(Object.assign({ defaultCurrency: "USD", errorNotifier(message, error) {
7
- console.error(message, error);
8
- } }, configOverrides));
package/dist/currency.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatCurrency = formatCurrency;
4
- const config_1 = require("./config");
5
- function formatCurrency(amount, currency = config_1.config.defaultCurrency) {
6
- return amount.toLocaleString("en", {
7
- style: "currency",
8
- currency: currency,
9
- });
10
- }
package/dist/global.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.global = void 0;
4
- const global = {};
5
- function getGlobal() {
6
- if (typeof window !== "undefined") {
7
- return window;
8
- }
9
- return global;
10
- }
11
- const glob = getGlobal();
12
- exports.global = glob;
package/dist/index.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- // comments for manual release
18
- __exportStar(require("./currency"), exports);
19
- __exportStar(require("./CurrencyType"), exports);
20
- __exportStar(require("./config"), exports);