@typeolymp/utils 0.1.23 → 0.2.1

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/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # 🛠 utils
2
+ The `utils` repository is a package created to streamline development across various codebases of TypeOlymp. This package includes a collection of `enums`, `expressions` and `parsers` that can be easily integrated into different projects, enhancing code consistency and reducing development time. It is written in [Typescript](https://www.typescriptlang.org/).
3
+
4
+ ## 📖 Table of Contents
5
+ - [Contributing](https://github.com/TypeOlymp/utils/tree/main#-contributing)
6
+
7
+ ## 👫 Contributing
8
+ To contribute to the `utils` package, follow these step:
9
+ 1. **Clone the Repository:** Clone the [repository](https://github.com/TypeOlymp/utils) to your local machine.
10
+ 3. **Create a Branch:** Create a new branch for your changes using a descriptive name: `git checkout -b feature/my-new-feature`.
11
+ 4. **Make Changes:** Make your desired changes and improvements to the codebase.
12
+ 5. **Commit Changes:** Commit your changes with a clear and concise commit message: `git commit -m "Add a new feature"`.
13
+ 6. **Push Changes:** Push your changes to your development branch: `git push origin feature/my-new-feature`.
14
+ 7. **Update the CHANGELOG:** Update the `CHANGELOG.md` file with the new changes.
15
+ 8. **Open a Pull Request:** Visit the [repository](https://github.com/TypeOlymp/utils) and open a Pull Request. Describe your changes, and submit the pull request.
@@ -1,6 +1,5 @@
1
1
  export * from "./AccountType";
2
2
  export * from "./AchievementType";
3
- export * from "./ChartDataType";
4
3
  export * from "./Color";
5
4
  export * from "./Country";
6
5
  export * from "./CourseTranslation";
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./AccountType"), exports);
18
18
  __exportStar(require("./AchievementType"), exports);
19
- __exportStar(require("./ChartDataType"), exports);
20
19
  __exportStar(require("./Color"), exports);
21
20
  __exportStar(require("./Country"), exports);
22
21
  __exportStar(require("./CourseTranslation"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,oDAAkC;AAClC,kDAAgC;AAChC,0CAAwB;AACxB,4CAA0B;AAC1B,sDAAoC;AACpC,6CAA2B;AAC3B,iDAA+B;AAC/B,+CAA6B;AAC7B,mDAAiC;AACjC,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,yCAAuB;AACvB,8CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/enums/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,oDAAkC;AAClC,0CAAwB;AACxB,4CAA0B;AAC1B,sDAAoC;AACpC,6CAA2B;AAC3B,iDAA+B;AAC/B,+CAA6B;AAC7B,mDAAiC;AACjC,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,yCAAuB;AACvB,8CAA4B"}
@@ -0,0 +1,2 @@
1
+ import { Currency, Locale } from "../enums";
2
+ export declare const formatPrice: (locale: Locale, currency: Currency, price: number) => string;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatPrice = void 0;
4
+ var formatPrice = function (locale, currency, price) {
5
+ return new Intl.NumberFormat(locale, { style: "currency", currency: currency }).format(price);
6
+ };
7
+ exports.formatPrice = formatPrice;
8
+ //# sourceMappingURL=formatPrice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatPrice.js","sourceRoot":"","sources":["../../src/parsers/formatPrice.ts"],"names":[],"mappings":";;;AAEO,IAAM,WAAW,GAAG,UACzB,MAAc,EACd,QAAkB,EAClB,KAAa;IAEb,OAAA,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,UAAA,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;AAA5E,CAA4E,CAAC;AALlE,QAAA,WAAW,eAKuD"}
@@ -0,0 +1,2 @@
1
+ import { Currency, Locale } from "../enums";
2
+ export declare const getCurrencyByLocale: (locale: Locale) => Currency;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCurrencyByLocale = void 0;
4
+ var enums_1 = require("../enums");
5
+ var getCurrencyByLocale = function (locale) {
6
+ var _a;
7
+ var map = (_a = {},
8
+ _a[enums_1.Locale.NL_NL] = enums_1.Currency.EUR,
9
+ _a[enums_1.Locale.NL_BE] = enums_1.Currency.EUR,
10
+ _a);
11
+ return map[locale];
12
+ };
13
+ exports.getCurrencyByLocale = getCurrencyByLocale;
14
+ //# sourceMappingURL=getCurrencyByLocale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCurrencyByLocale.js","sourceRoot":"","sources":["../../src/parsers/getCurrencyByLocale.ts"],"names":[],"mappings":";;;AAAA,kCAA4C;AAErC,IAAM,mBAAmB,GAAG,UAAC,MAAc;;IAChD,IAAM,GAAG;QACP,GAAC,cAAM,CAAC,KAAK,IAAG,gBAAQ,CAAC,GAAG;QAC5B,GAAC,cAAM,CAAC,KAAK,IAAG,gBAAQ,CAAC,GAAG;WAC7B,CAAC;IAEF,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC,CAAC;AAPW,QAAA,mBAAmB,uBAO9B"}
@@ -0,0 +1,5 @@
1
+ import { Currency } from "../enums";
2
+ export declare const getPricing: (currency: Currency) => {
3
+ hobby: number;
4
+ professional: number;
5
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPricing = void 0;
4
+ var enums_1 = require("../enums");
5
+ var getPricing = function (currency) {
6
+ var _a, _b;
7
+ var plans = (_a = {},
8
+ _a[enums_1.Plan.HOBBY] = { EUR: 0, GBP: 0, USD: 0 },
9
+ _a[enums_1.Plan.PROFESSIONAL] = { EUR: 14.95, GBP: 12.95, USD: 15.95 },
10
+ _a);
11
+ var pricing = (_b = {},
12
+ _b[enums_1.Plan.HOBBY] = plans.hobby[currency],
13
+ _b[enums_1.Plan.PROFESSIONAL] = plans.professional[currency],
14
+ _b);
15
+ return pricing;
16
+ };
17
+ exports.getPricing = getPricing;
18
+ //# sourceMappingURL=getPricing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPricing.js","sourceRoot":"","sources":["../../src/parsers/getPricing.ts"],"names":[],"mappings":";;;AAAA,kCAA0C;AAEnC,IAAM,UAAU,GAAG,UAAC,QAAkB;;IAC3C,IAAM,KAAK;QACT,GAAC,YAAI,CAAC,KAAK,IAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;QACxC,GAAC,YAAI,CAAC,YAAY,IAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;WAC5D,CAAC;IAEF,IAAM,OAAO;QACX,GAAC,YAAI,CAAC,KAAK,IAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC;QACnC,GAAC,YAAI,CAAC,YAAY,IAAG,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC;WAClD,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB"}
@@ -1,6 +1,9 @@
1
+ export * from "./formatPrice";
1
2
  export * from "./getCountryByLocale";
2
3
  export * from "./getCourseTranslationByLocale";
4
+ export * from "./getCurrencyByLocale";
3
5
  export * from "./getKeyboardLayoutByLocale";
4
6
  export * from "./getLanguageCodeByLocale";
5
7
  export * from "./getCountryCodeByLocale";
6
8
  export * from "./getNativeLanguageByLocale";
9
+ export * from "./getPricing";
@@ -14,10 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./formatPrice"), exports);
17
18
  __exportStar(require("./getCountryByLocale"), exports);
18
19
  __exportStar(require("./getCourseTranslationByLocale"), exports);
20
+ __exportStar(require("./getCurrencyByLocale"), exports);
19
21
  __exportStar(require("./getKeyboardLayoutByLocale"), exports);
20
22
  __exportStar(require("./getLanguageCodeByLocale"), exports);
21
23
  __exportStar(require("./getCountryCodeByLocale"), exports);
22
24
  __exportStar(require("./getNativeLanguageByLocale"), exports);
25
+ __exportStar(require("./getPricing"), exports);
23
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parsers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,iEAA+C;AAC/C,8DAA4C;AAC5C,4DAA0C;AAC1C,2DAAyC;AACzC,8DAA4C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parsers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,uDAAqC;AACrC,iEAA+C;AAC/C,wDAAsC;AACtC,8DAA4C;AAC5C,4DAA0C;AAC1C,2DAAyC;AACzC,8DAA4C;AAC5C,+CAA6B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeolymp/utils",
3
- "version": "0.1.23",
3
+ "version": "0.2.1",
4
4
  "author": "TypeOlymp",
5
5
  "main": "build/index",
6
6
  "files": [