@bccampus/utils 0.1.1 → 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.
Files changed (72) hide show
  1. package/dist/array/chunk.cjs +9 -0
  2. package/dist/array/index.cjs +4 -0
  3. package/dist/date/index.cjs +8 -0
  4. package/dist/date/iso-date-time.cjs +256 -0
  5. package/dist/duration/add-durations.cjs +12 -0
  6. package/dist/duration/index.cjs +8 -0
  7. package/dist/duration/is-duration.cjs +7 -0
  8. package/dist/duration/to-number.cjs +14 -0
  9. package/dist/format/formatter.cjs +40 -0
  10. package/dist/format/index.cjs +13 -0
  11. package/dist/format/stringify.cjs +42 -0
  12. package/dist/format/template.cjs +35 -0
  13. package/dist/object/get.cjs +7 -0
  14. package/dist/object/index.cjs +12 -0
  15. package/dist/object/is-object.cjs +4 -0
  16. package/dist/object/omit.cjs +18 -0
  17. package/dist/object/pick.cjs +11 -0
  18. package/dist/object/set.cjs +14 -0
  19. package/dist/path/file-url-to-path.cjs +10 -0
  20. package/dist/path/file-url-to-path.d.ts +4 -0
  21. package/dist/path/file-url-to-path.js +10 -0
  22. package/dist/path/index.cjs +6 -0
  23. package/dist/path/index.d.ts +2 -0
  24. package/dist/path/index.js +6 -0
  25. package/dist/path/normalize.cjs +32 -0
  26. package/dist/path/normalize.d.ts +31 -0
  27. package/dist/path/normalize.js +32 -0
  28. package/dist/set/difference.cjs +10 -0
  29. package/dist/set/index.cjs +12 -0
  30. package/dist/set/intersection.cjs +13 -0
  31. package/dist/set/is-superset.cjs +12 -0
  32. package/dist/set/symmetric-difference.cjs +14 -0
  33. package/dist/set/union.cjs +10 -0
  34. package/dist/string/capitalize.cjs +4 -0
  35. package/dist/string/index.cjs +14 -0
  36. package/dist/string/normalize.cjs +6 -0
  37. package/dist/string/normalize.d.ts +5 -0
  38. package/dist/string/normalize.js +6 -0
  39. package/dist/string/pluralize/index.cjs +6 -0
  40. package/dist/string/pluralize/pluralize.cjs +210 -0
  41. package/dist/string/pluralize/rules/index.cjs +10 -0
  42. package/dist/string/pluralize/rules/irregular.cjs +62 -0
  43. package/dist/string/pluralize/rules/pluralization.cjs +39 -0
  44. package/dist/string/pluralize/rules/singularization.cjs +47 -0
  45. package/dist/string/pluralize/rules/uncountable.cjs +113 -0
  46. package/dist/string/pluralize/types.cjs +1 -0
  47. package/dist/string/slugify/index.cjs +2263 -0
  48. package/dist/string/strip-html-tags.cjs +7 -0
  49. package/dist/string/to-int.cjs +10 -0
  50. package/dist/string/to-sentence-case.cjs +8 -0
  51. package/dist/string/trim.cjs +11 -0
  52. package/dist/string/truncate.cjs +20 -0
  53. package/dist/string/truncate.d.ts +22 -1
  54. package/dist/string/truncate.js +14 -3
  55. package/dist/value/index.cjs +4 -0
  56. package/dist/value/index.d.ts +1 -0
  57. package/dist/value/index.js +4 -0
  58. package/dist/value/is-empty.cjs +14 -0
  59. package/dist/value/is-empty.d.ts +17 -0
  60. package/dist/value/is-empty.js +14 -0
  61. package/package.json +29 -10
  62. package/src/format/index.ts +3 -3
  63. package/src/path/file-url-to-path.ts +12 -0
  64. package/src/path/index.ts +2 -0
  65. package/src/path/normalize.ts +72 -0
  66. package/src/string/normalize.ts +7 -0
  67. package/src/string/truncate.ts +44 -11
  68. package/src/value/index.ts +1 -0
  69. package/src/value/is-empty.ts +31 -0
  70. package/tsconfig.lib.json +36 -35
  71. package/vite.config.ts +75 -77
  72. package/tsconfig.lib.tsbuildinfo +0 -1
package/vite.config.ts CHANGED
@@ -1,77 +1,75 @@
1
- import path from "node:path";
2
- import { fileURLToPath } from "node:url";
3
- import { globSync } from "tinyglobby";
4
- import { defineConfig } from "vite";
5
- import dts from "vite-plugin-dts";
6
- import packageConfig from "./package.json";
7
- import { writeFileSync } from "node:fs";
8
-
9
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
- const outDir = "./dist";
11
-
12
- const createEntries = () => {
13
- const entries = new Map<string, string>();
14
- const exports = new Map<
15
- string,
16
- {
17
- types: string;
18
- import: string;
19
- }
20
- >();
21
-
22
- const files = globSync("src/**/*.ts", {
23
- cwd: __dirname,
24
- });
25
-
26
- for (const file of files) {
27
- const filePath = file.split(".")[0].replace(/^src[/\\]/, "");
28
-
29
- if (!filePath) {
30
- continue;
31
- }
32
-
33
- const filePathParts = filePath.split("/");
34
- if (filePathParts.at(-1) === "index" && filePathParts.length <= 3) {
35
- const exportPath =
36
- filePathParts.length === 1
37
- ? "."
38
- : `./${filePathParts.slice(0, -1).join("/")}`;
39
-
40
- exports.set(exportPath, {
41
- types: `${outDir}/${filePath}.d.ts`,
42
- import: `${outDir}/${filePath}.js`,
43
- });
44
- }
45
-
46
- entries.set(filePath, fileURLToPath(new URL(file, import.meta.url)));
47
- }
48
-
49
- const _packageConfig = {
50
- ...packageConfig,
51
- exports: Object.fromEntries(exports),
52
- };
53
-
54
- writeFileSync("./package.json", JSON.stringify(_packageConfig, null, 2), {
55
- encoding: "utf-8",
56
- });
57
-
58
- return Object.fromEntries(entries);
59
- };
60
-
61
- export default defineConfig({
62
- plugins: [dts({ tsconfigPath: "./tsconfig.lib.json" })],
63
- resolve: {
64
- alias: {
65
- "@": path.resolve(__dirname, "./src"),
66
- },
67
- },
68
- build: {
69
- minify: false,
70
- copyPublicDir: false,
71
- lib: {
72
- entry: createEntries(),
73
- name: "utils",
74
- formats: ["es"],
75
- },
76
- },
77
- });
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { globSync } from "tinyglobby";
4
+ import { defineConfig } from "vite";
5
+ import dts from "vite-plugin-dts";
6
+ import packageConfig from "./package.json";
7
+ import { writeFileSync } from "node:fs";
8
+
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+ const outDir = "./dist";
11
+
12
+ const createEntries = () => {
13
+ const entries = new Map<string, string>();
14
+ const exports = new Map<
15
+ string,
16
+ {
17
+ types: string;
18
+ import: string;
19
+ require: string;
20
+ }
21
+ >();
22
+
23
+ const files = globSync("src/**/*.ts", {
24
+ cwd: __dirname,
25
+ });
26
+
27
+ for (const file of files) {
28
+ const filePath = file.split(".")[0].replace(/^src[/\\]/, "");
29
+
30
+ if (!filePath) {
31
+ continue;
32
+ }
33
+
34
+ const filePathParts = filePath.split("/");
35
+ if (filePathParts.at(-1) === "index" && filePathParts.length <= 3) {
36
+ const exportPath = filePathParts.length === 1 ? "." : `./${filePathParts.slice(0, -1).join("/")}`;
37
+
38
+ exports.set(exportPath, {
39
+ types: `${outDir}/${filePath}.d.ts`,
40
+ import: `${outDir}/${filePath}.js`,
41
+ require: `${outDir}/${filePath}.cjs`,
42
+ });
43
+ }
44
+
45
+ entries.set(filePath, fileURLToPath(new URL(file, import.meta.url)));
46
+ }
47
+
48
+ const _packageConfig = {
49
+ ...packageConfig,
50
+ exports: Object.fromEntries(exports),
51
+ };
52
+
53
+ writeFileSync("./package.json", JSON.stringify(_packageConfig, null, 2), {
54
+ encoding: "utf-8",
55
+ });
56
+
57
+ return Object.fromEntries(entries);
58
+ };
59
+
60
+ export default defineConfig({
61
+ plugins: [dts({ tsconfigPath: "./tsconfig.lib.json" })],
62
+ resolve: {
63
+ alias: {
64
+ "@": path.resolve(__dirname, "./src"),
65
+ },
66
+ },
67
+ build: {
68
+ minify: false,
69
+ copyPublicDir: false,
70
+ lib: {
71
+ entry: createEntries(),
72
+ name: "utils",
73
+ },
74
+ },
75
+ });
@@ -1 +0,0 @@
1
- {"root":["./src/array/chunk.ts","./src/array/index.ts","./src/date/index.ts","./src/date/iso-date-time.ts","./src/duration/add-durations.ts","./src/duration/index.ts","./src/duration/is-duration.ts","./src/duration/to-number.ts","./src/format/formatter.ts","./src/format/index.ts","./src/format/stringify.ts","./src/format/template.ts","./src/object/get.ts","./src/object/index.ts","./src/object/is-object.ts","./src/object/omit.ts","./src/object/pick.ts","./src/object/set.ts","./src/set/difference.ts","./src/set/index.ts","./src/set/intersection.ts","./src/set/is-superset.ts","./src/set/symmetric-difference.ts","./src/set/union.ts","./src/string/capitalize.ts","./src/string/index.ts","./src/string/strip-html-tags.ts","./src/string/to-int.ts","./src/string/to-sentence-case.ts","./src/string/trim.ts","./src/string/truncate.ts","./src/string/pluralize/index.ts","./src/string/pluralize/pluralize.ts","./src/string/pluralize/types.ts","./src/string/pluralize/rules/index.ts","./src/string/pluralize/rules/irregular.ts","./src/string/pluralize/rules/pluralization.ts","./src/string/pluralize/rules/singularization.ts","./src/string/pluralize/rules/uncountable.ts","./src/string/slugify/index.ts"],"version":"5.9.3"}