@visulima/humanizer 3.0.0-alpha.1 → 3.0.0-alpha.3

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 CHANGED
@@ -1,15 +1,24 @@
1
- <div align="center">
2
- <h3>Visulima humanizer</h3>
3
- <p>
4
- Humanizer is a library for humanizing data in a human-readable form.
5
- </p>
6
- </div>
1
+ <!-- START_PACKAGE_OG_IMAGE_PLACEHOLDER -->
2
+
3
+ <a href="https://www.anolilab.com/open-source" align="center">
4
+
5
+ <img src="__assets__/package-og.svg" alt="humanizer" />
6
+
7
+ </a>
8
+
9
+ <h3 align="center">Humanizer is a library for humanizing data in a human-readable form.</h3>
10
+
11
+ <!-- END_PACKAGE_OG_IMAGE_PLACEHOLDER -->
7
12
 
8
13
  <br />
9
14
 
10
15
  <div align="center">
11
16
 
12
- [![typescript-image]][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]
17
+ [![typescript-image][typescript-badge]][typescript-url]
18
+ [![mit licence][license-badge]][license]
19
+ [![npm downloads][npm-downloads-badge]][npm-downloads]
20
+ [![Chat][chat-badge]][chat]
21
+ [![PRs Welcome][prs-welcome-badge]][prs-welcome]
13
22
 
14
23
  </div>
15
24
 
@@ -1056,14 +1065,23 @@ If you would like to help take a look at the [list of issues](https://github.com
1056
1065
  - [Daniel Bannert](https://github.com/prisis)
1057
1066
  - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
1058
1067
 
1068
+ ## Made with ❤️ at Anolilab
1069
+
1070
+ This is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Anolilab](https://www.anolilab.com/open-source) is a Development and AI Studio. Contact us at [hello@anolilab.com](mailto:hello@anolilab.com) if you need any help with these technologies or just want to say hi!
1071
+
1059
1072
  ## License
1060
1073
 
1061
- The visulima humanizer is open-sourced software licensed under the [MIT][license-url]
1074
+ The visulima humanizer is open-sourced software licensed under the [MIT][license]
1062
1075
 
1063
- [typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
1076
+ <!-- badges -->
1064
1077
 
1065
- [typescript-url]: https://www.typescriptlang.org/ "TypeScript" "typescript"
1066
- [license-image]: https://img.shields.io/npm/l/@visulima/humanizer?color=blueviolet&style=for-the-badge
1067
- [license-url]: LICENSE.md "license"
1068
- [npm-image]: https://img.shields.io/npm/v/@visulima/humanizer/latest.svg?style=for-the-badge&logo=npm
1069
- [npm-url]: https://www.npmjs.com/package/@visulima/humanizer/v/latest "npm"
1078
+ [license-badge]: https://img.shields.io/npm/l/@visulima/humanizer?style=for-the-badge
1079
+ [license]: https://github.com/visulima/visulima/blob/main/LICENSE
1080
+ [npm-downloads-badge]: https://img.shields.io/npm/dm/@visulima/humanizer?style=for-the-badge
1081
+ [npm-downloads]: https://www.npmjs.com/package/@visulima/humanizer
1082
+ [prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
1083
+ [prs-welcome]: https://github.com/visulima/visulima/blob/main/.github/CONTRIBUTING.md
1084
+ [chat-badge]: https://img.shields.io/discord/932323359193186354.svg?style=for-the-badge
1085
+ [chat]: https://discord.gg/TtFJY8xkFK
1086
+ [typescript-badge]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
1087
+ [typescript-url]: https://www.typescriptlang.org/
@@ -28,15 +28,30 @@ const roUnitMap = {
28
28
  zi: "d",
29
29
  zile: "d"
30
30
  };
31
+ const romanianUnit = (unit) => {
32
+ return (counter) => {
33
+ if (counter === 1) {
34
+ return unit[0];
35
+ }
36
+ if (Math.floor(counter) !== counter || counter === 0) {
37
+ return unit[1];
38
+ }
39
+ const remainder = counter % 100;
40
+ if (remainder >= 1 && remainder <= 19) {
41
+ return unit[1];
42
+ }
43
+ return unit[2];
44
+ };
45
+ };
31
46
  const durationLanguage = createDurationLanguage(
32
- (counter) => counter === 1 ? "an" : "ani",
33
- (counter) => counter === 1 ? "lună" : "luni",
34
- (counter) => counter === 1 ? "săptămână" : "săptămâni",
35
- (counter) => counter === 1 ? "zi" : "zile",
36
- (counter) => counter === 1 ? "oră" : "ore",
37
- (counter) => counter === 1 ? "minut" : "minute",
38
- (counter) => counter === 1 ? "secundă" : "secunde",
39
- (counter) => counter === 1 ? "milisecundă" : "milisecunde",
47
+ romanianUnit(["an", "ani", "de ani"]),
48
+ romanianUnit(["lună", "luni", "de luni"]),
49
+ romanianUnit(["săptămână", "săptămâni", "de săptămâni"]),
50
+ romanianUnit(["zi", "zile", "de zile"]),
51
+ romanianUnit(["oră", "ore", "de ore"]),
52
+ romanianUnit(["minut", "minute", "de minute"]),
53
+ romanianUnit(["secundă", "secunde", "de secunde"]),
54
+ romanianUnit(["milisecundă", "milisecunde", "de milisecunde"]),
40
55
  "peste %s",
41
56
  // "in %s"
42
57
  "%s în urmă",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/humanizer",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.3",
4
4
  "description": "Humanizer is a library for humanizing data in a human-readable form.",
5
5
  "keywords": [
6
6
  "visulima",