@manta-eu/lib 0.1.7 → 0.1.9

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
@@ -3,6 +3,8 @@
3
3
  Small TypeScript helpers shared across the Manta packages — plain functions and types, no
4
4
  framework and no service calls.
5
5
 
6
+ Documentation: [developers.manta.eu](https://developers.manta.eu)
7
+
6
8
  ## Installation
7
9
 
8
10
  ```bash
@@ -8,9 +8,8 @@ export declare function humanDimensions({ width, height }: {
8
8
  height: number;
9
9
  }): string;
10
10
  export declare function humanPlural(word: string, count: number): string;
11
- export type HumanListOptions = {
11
+ export type HumanListOptions = Intl.ListFormatOptions & {
12
12
  truncateAt?: number;
13
- conjunction?: string;
14
13
  };
15
14
  export declare function humanList(list: string[], options?: HumanListOptions): string;
16
15
  export type HumanDurationArgs = {
@@ -1 +1 @@
1
- {"version":3,"file":"humanize.d.ts","sourceRoot":"","sources":["../src/humanize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAA0B,MAAM,UAAU,CAAC;AAOhE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CASxD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAS1E;AAED,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE5F;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,MAAM,M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F,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAY5E;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAYF,wBAAgB,aAAa,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAW7D"}
package/dist/humanize.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { formatDuration, intervalToDuration } from "date-fns";
2
2
  import { filesize } from "filesize";
3
- import humanizeList from "humanize-list";
4
3
  import pluralize from "pluralize";
5
4
  import { isPresent } from "./present.js";
6
5
  export function humanBytes(input) {
@@ -40,16 +39,14 @@ export function humanPlural(word, count) {
40
39
  return pluralize(word, count, false);
41
40
  }
42
41
  export function humanList(list, options) {
43
- const { truncateAt, conjunction = "and" } = options || {};
42
+ const { truncateAt, ...formatOptions } = options || {};
43
+ const listFormat = new Intl.ListFormat("en", formatOptions);
44
44
  if (!truncateAt || list.length <= truncateAt) {
45
- return humanizeList(list, {
46
- oxfordComma: list.length > 2,
47
- conjunction,
48
- });
45
+ return listFormat.format(list);
49
46
  }
50
47
  const remaining = list.length - truncateAt;
51
48
  const truncated = [...list.slice(0, truncateAt), `+${remaining} more`];
52
- return humanizeList(truncated, { oxfordComma: true, conjunction });
49
+ return listFormat.format(truncated);
53
50
  }
54
51
  const periods = ["years", "months", "weeks", "days", "hours", "minutes", "seconds"];
55
52
  function getDurationFormat(duration, largest) {
package/package.json CHANGED
@@ -1,11 +1,19 @@
1
1
  {
2
2
  "name": "@manta-eu/lib",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Pure TypeScript helpers shared across the Manta packages",
5
+ "homepage": "https://developers.manta.eu",
6
+ "keywords": [
7
+ "manta",
8
+ "knowledge-graph",
9
+ "typescript",
10
+ "utilities"
11
+ ],
5
12
  "license": "MIT",
6
13
  "type": "module",
7
14
  "exports": {
8
15
  "./*": {
16
+ "manta-source": "./src/*.ts",
9
17
  "types": "./dist/*.d.ts",
10
18
  "import": "./dist/*.js"
11
19
  }
@@ -16,7 +24,6 @@
16
24
  "dependencies": {
17
25
  "date-fns": "^4.1.0",
18
26
  "filesize": "^11.0.2",
19
- "humanize-list": "^1.0.1",
20
27
  "pluralize": "^8.0.0",
21
28
  "ramda": "^0.32.0"
22
29
  },