@onivoro/isomorphic-common 0.0.16 → 0.0.17
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/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/functions/to-dollars-and-cents.function.d.ts +1 -0
- package/src/lib/functions/to-dollars-and-cents.function.js +16 -0
- package/src/lib/functions/to-dollars-and-cents.function.js.map +1 -0
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export * from './lib/functions/to-boolean-string.function';
|
|
|
17
17
|
export * from './lib/functions/to-calendar-date.function';
|
|
18
18
|
export * from './lib/functions/to-csv-string.function';
|
|
19
19
|
export * from './lib/functions/to-decimal-base.function';
|
|
20
|
+
export * from './lib/functions/to-dollars-and-cents.function';
|
|
20
21
|
export * from './lib/functions/to-locale-date-string.function';
|
|
21
22
|
export * from './lib/functions/to-locale-time-string.function';
|
|
22
23
|
export * from './lib/functions/to-unique-array.function';
|
package/src/index.js
CHANGED
|
@@ -20,6 +20,7 @@ tslib_1.__exportStar(require("./lib/functions/to-boolean-string.function"), expo
|
|
|
20
20
|
tslib_1.__exportStar(require("./lib/functions/to-calendar-date.function"), exports);
|
|
21
21
|
tslib_1.__exportStar(require("./lib/functions/to-csv-string.function"), exports);
|
|
22
22
|
tslib_1.__exportStar(require("./lib/functions/to-decimal-base.function"), exports);
|
|
23
|
+
tslib_1.__exportStar(require("./lib/functions/to-dollars-and-cents.function"), exports);
|
|
23
24
|
tslib_1.__exportStar(require("./lib/functions/to-locale-date-string.function"), exports);
|
|
24
25
|
tslib_1.__exportStar(require("./lib/functions/to-locale-time-string.function"), exports);
|
|
25
26
|
tslib_1.__exportStar(require("./lib/functions/to-unique-array.function"), exports);
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/isomorphic-common/src/index.ts"],"names":[],"mappings":";;;AAAA,kFAAwD;AACxD,mFAAyD;AACzD,qFAA2D;AAE3D,8EAAoD;AACpD,8EAAoD;AACpD,6FAAmE;AACnE,uFAA6D;AAC7D,sFAA4D;AAC5D,mFAAyD;AACzD,8EAAoD;AACpD,8EAAoD;AACpD,uFAA6D;AAC7D,qFAA2D;AAC3D,8EAAoD;AACpD,mFAAyD;AACzD,qFAA2D;AAC3D,oFAA0D;AAC1D,iFAAuD;AACvD,mFAAyD;AACzD,yFAA+D;AAC/D,yFAA+D;AAC/D,mFAAyD;AACzD,4EAAkD;AAClD,kFAAwD;AACxD,8EAAoD;AACpD,+EAAqD;AACrD,yEAA+C;AAE/C,kGAAwE;AACxE,qFAA2D;AAC3D,wEAA8C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/isomorphic-common/src/index.ts"],"names":[],"mappings":";;;AAAA,kFAAwD;AACxD,mFAAyD;AACzD,qFAA2D;AAE3D,8EAAoD;AACpD,8EAAoD;AACpD,6FAAmE;AACnE,uFAA6D;AAC7D,sFAA4D;AAC5D,mFAAyD;AACzD,8EAAoD;AACpD,8EAAoD;AACpD,uFAA6D;AAC7D,qFAA2D;AAC3D,8EAAoD;AACpD,mFAAyD;AACzD,qFAA2D;AAC3D,oFAA0D;AAC1D,iFAAuD;AACvD,mFAAyD;AACzD,wFAA8D;AAC9D,yFAA+D;AAC/D,yFAA+D;AAC/D,mFAAyD;AACzD,4EAAkD;AAClD,kFAAwD;AACxD,8EAAoD;AACpD,+EAAqD;AACrD,yEAA+C;AAE/C,kGAAwE;AACxE,qFAA2D;AAC3D,wEAA8C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toDollarsAndCents(number: any): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toDollarsAndCents = void 0;
|
|
4
|
+
const to_words_function_1 = require("./to-words.function");
|
|
5
|
+
function toDollarsAndCents(number) {
|
|
6
|
+
const num = Number(number);
|
|
7
|
+
const decimal = (Math.round((num % 1) * 100)) / 100;
|
|
8
|
+
const int = num - decimal;
|
|
9
|
+
const dollars = `${(0, to_words_function_1.toWords)(int)} dollars`;
|
|
10
|
+
if (!decimal) {
|
|
11
|
+
return dollars;
|
|
12
|
+
}
|
|
13
|
+
return `${dollars} and ${(0, to_words_function_1.toWords)(decimal * 100)} cents`;
|
|
14
|
+
}
|
|
15
|
+
exports.toDollarsAndCents = toDollarsAndCents;
|
|
16
|
+
//# sourceMappingURL=to-dollars-and-cents.function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-dollars-and-cents.function.js","sourceRoot":"","sources":["../../../../../../libs/isomorphic-common/src/lib/functions/to-dollars-and-cents.function.ts"],"names":[],"mappings":";;;AAAA,2DAA8C;AAE9C,SAAgB,iBAAiB,CAAC,MAAW;IACzC,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IACpD,MAAM,GAAG,GAAG,GAAG,GAAG,OAAO,CAAC;IAE1B,MAAM,OAAO,GAAG,GAAG,IAAA,2BAAO,EAAC,GAAG,CAAC,UAAU,CAAC;IAE1C,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,OAAO,CAAC;KAClB;IAED,OAAO,GAAG,OAAO,QAAQ,IAAA,2BAAO,EAAC,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC5D,CAAC;AAZD,8CAYC"}
|