mhz-helpers 0.0.1 → 1.0.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.
@@ -0,0 +1,7 @@
1
+ export declare function createTempId(): string;
2
+ export declare function deleteTempId<T extends {
3
+ _id?: string;
4
+ }>(array: T[]): T[];
5
+ export declare function deleteId<T extends {
6
+ _id?: string;
7
+ }>(array: T[]): T[];
@@ -1,2 +1,3 @@
1
1
  export * from './clone';
2
2
  export * from './date';
3
+ export * from './id';
package/dist/index.js CHANGED
@@ -1,29 +1,41 @@
1
- import { computed as u, toRaw as m } from "vue";
2
- function c(t) {
3
- const o = u(() => t.value?.data), n = u(() => t.value?.total);
4
- function i(r, e) {
5
- return !n.value || r === 0 || r === n.value + 1 ? e : r;
1
+ import { computed as i, toRaw as o } from "vue";
2
+ function c(e) {
3
+ const t = i(() => e.value?.data), n = i(() => e.value?.total);
4
+ function m(r, u) {
5
+ return !n.value || r === 0 || r === n.value + 1 ? u : r;
6
6
  }
7
- return { data: o, total: n, setPage: i };
7
+ return { data: t, total: n, setPage: m };
8
8
  }
9
- function f(t) {
10
- return structuredClone(m(t));
9
+ function f(e) {
10
+ return structuredClone(o(e));
11
11
  }
12
- function l(t) {
13
- return t ? new Intl.DateTimeFormat().format(new Date(t)) : "-";
12
+ function l(e) {
13
+ return e ? new Intl.DateTimeFormat().format(new Date(e)) : "-";
14
14
  }
15
- function D(t) {
16
- return t ? new Intl.DateTimeFormat(void 0, {
15
+ function d(e) {
16
+ return e ? new Intl.DateTimeFormat(void 0, {
17
17
  year: "numeric",
18
18
  month: "numeric",
19
19
  day: "numeric",
20
20
  hour: "numeric",
21
21
  minute: "numeric"
22
- }).format(new Date(t)) : "-";
22
+ }).format(new Date(e)) : "-";
23
+ }
24
+ function p() {
25
+ return `temp-${crypto.randomUUID()}`;
26
+ }
27
+ function s(e) {
28
+ return e.map((t) => (t._id?.includes("temp") && delete t._id, t));
29
+ }
30
+ function D(e) {
31
+ return e.map((t) => (delete t._id, t));
23
32
  }
24
33
  export {
25
34
  f as clone,
35
+ p as createTempId,
36
+ D as deleteId,
37
+ s as deleteTempId,
26
38
  l as formatDate,
27
- D as formatDateTime,
39
+ d as formatDateTime,
28
40
  c as usePagination
29
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mhz-helpers",
3
- "version": "0.0.1",
3
+ "version": "1.0.1",
4
4
  "description": "mhz-helpers",
5
5
  "author": "dergunov.com",
6
6
  "type": "module",
@@ -19,16 +19,16 @@
19
19
  "vue": "3.3.4"
20
20
  },
21
21
  "devDependencies": {
22
- "@types/node": "20.4.9",
22
+ "@types/node": "20.4.10",
23
23
  "@typescript-eslint/eslint-plugin": "6.3.0",
24
24
  "@typescript-eslint/parser": "6.3.0",
25
25
  "@vitejs/plugin-vue": "4.2.3",
26
- "eslint": "8.46.0",
26
+ "eslint": "8.47.0",
27
27
  "eslint-config-prettier": "9.0.0",
28
- "eslint-import-resolver-typescript": "3.5.5",
28
+ "eslint-import-resolver-typescript": "3.6.0",
29
29
  "eslint-plugin-import": "2.28.0",
30
30
  "eslint-plugin-prettier": "5.0.0",
31
- "eslint-plugin-vue": "9.16.1",
31
+ "eslint-plugin-vue": "9.17.0",
32
32
  "postcss-html": "1.5.0",
33
33
  "prettier": "3.0.1",
34
34
  "stylelint": "15.10.2",
@@ -38,7 +38,7 @@
38
38
  "stylelint-prettier": "4.0.2",
39
39
  "typescript": "5.1.6",
40
40
  "vite": "4.4.9",
41
- "vite-plugin-dts": "3.5.1",
41
+ "vite-plugin-dts": "3.5.2",
42
42
  "vue-linters-config": "0.1.6",
43
43
  "vue-tsc": "1.8.8"
44
44
  },