@juisy/utils 3.0.0-beta.0

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 (95) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +51 -0
  3. package/dist/assert/argsert.d.ts +92 -0
  4. package/dist/assert/argsert.js +45 -0
  5. package/dist/assert/assert.d.ts +457 -0
  6. package/dist/assert/assert.js +100 -0
  7. package/dist/constructor/apply-mixins.d.ts +15 -0
  8. package/dist/constructor/apply-mixins.js +23 -0
  9. package/dist/constructor/get-constructor-name.d.ts +19 -0
  10. package/dist/constructor/get-constructor-name.js +18 -0
  11. package/dist/date/date-format.d.ts +18 -0
  12. package/dist/date/date-format.js +15 -0
  13. package/dist/date/get-date-range.d.ts +38 -0
  14. package/dist/date/get-date-range.js +32 -0
  15. package/dist/date/get-duration-between-times.d.ts +13 -0
  16. package/dist/date/get-duration-between-times.js +20 -0
  17. package/dist/date/get-duration-between.d.ts +12 -0
  18. package/dist/date/get-duration-between.js +16 -0
  19. package/dist/date/get-i18n-timezone-value.d.ts +19 -0
  20. package/dist/date/get-i18n-timezone-value.js +27 -0
  21. package/dist/date/get-next-date-for-time.d.ts +10 -0
  22. package/dist/date/get-next-date-for-time.js +16 -0
  23. package/dist/date/get-utc-offset.d.ts +10 -0
  24. package/dist/date/get-utc-offset.js +15 -0
  25. package/dist/fs/get-file-urls.d.ts +12 -0
  26. package/dist/fs/get-file-urls.js +13 -0
  27. package/dist/fs/get-files-sync.d.ts +19 -0
  28. package/dist/fs/get-files-sync.js +23 -0
  29. package/dist/fs/get-files.d.ts +23 -0
  30. package/dist/fs/get-files.js +21 -0
  31. package/dist/fs/get-root-dir.d.ts +15 -0
  32. package/dist/fs/get-root-dir.js +12 -0
  33. package/dist/fs/is-directory.d.ts +13 -0
  34. package/dist/fs/is-directory.js +17 -0
  35. package/dist/fs/is-file.d.ts +13 -0
  36. package/dist/fs/is-file.js +17 -0
  37. package/dist/is/is-def.d.ts +20 -0
  38. package/dist/is/is-def.js +10 -0
  39. package/dist/is/is-valid-css-color.d.ts +11 -0
  40. package/dist/is/is-valid-css-color.js +10 -0
  41. package/dist/is/is.d.ts +456 -0
  42. package/dist/is/is.js +102 -0
  43. package/dist/misc/compose.d.ts +18 -0
  44. package/dist/misc/compose.js +31 -0
  45. package/dist/misc/detect-browser.d.ts +19 -0
  46. package/dist/misc/detect-browser.js +12 -0
  47. package/dist/misc/type-check.d.ts +19 -0
  48. package/dist/misc/type-check.js +39 -0
  49. package/dist/object/deep-merge.d.ts +21 -0
  50. package/dist/object/deep-merge.js +10 -0
  51. package/dist/object/deep-parse.d.ts +18 -0
  52. package/dist/object/deep-parse.js +15 -0
  53. package/dist/object/get.d.ts +24 -0
  54. package/dist/object/get.js +12 -0
  55. package/dist/path/is-posix.d.ts +17 -0
  56. package/dist/path/is-posix.js +12 -0
  57. package/dist/path/is-same-as.d.ts +21 -0
  58. package/dist/path/is-same-as.js +13 -0
  59. package/dist/path/is-win32.d.ts +17 -0
  60. package/dist/path/is-win32.js +10 -0
  61. package/dist/path/normalize.d.ts +16 -0
  62. package/dist/path/normalize.js +22 -0
  63. package/dist/path/resolve-abs-from-root.d.ts +14 -0
  64. package/dist/path/resolve-abs-from-root.js +17 -0
  65. package/dist/path/resolve-rel-from-root.d.ts +14 -0
  66. package/dist/path/resolve-rel-from-root.js +13 -0
  67. package/dist/path/resolve-rel.d.ts +21 -0
  68. package/dist/path/resolve-rel.js +16 -0
  69. package/dist/path/to-os-format.d.ts +12 -0
  70. package/dist/path/to-os-format.js +14 -0
  71. package/dist/path/to-posix.d.ts +16 -0
  72. package/dist/path/to-posix.js +12 -0
  73. package/dist/path/to-win32.d.ts +16 -0
  74. package/dist/path/to-win32.js +12 -0
  75. package/dist/random/random-alpha-numeric.d.ts +22 -0
  76. package/dist/random/random-alpha-numeric.js +12 -0
  77. package/dist/random/random-number.d.ts +23 -0
  78. package/dist/random/random-number.js +12 -0
  79. package/dist/string/camelcase.d.ts +22 -0
  80. package/dist/string/camelcase.js +12 -0
  81. package/dist/string/capitalize.d.ts +23 -0
  82. package/dist/string/capitalize.js +18 -0
  83. package/dist/string/constantcase.d.ts +16 -0
  84. package/dist/string/constantcase.js +12 -0
  85. package/dist/string/kebabcase.d.ts +22 -0
  86. package/dist/string/kebabcase.js +12 -0
  87. package/dist/string/lowercase.d.ts +22 -0
  88. package/dist/string/lowercase.js +12 -0
  89. package/dist/string/pascalcase.d.ts +16 -0
  90. package/dist/string/pascalcase.js +13 -0
  91. package/dist/string/snakecase.d.ts +22 -0
  92. package/dist/string/snakecase.js +12 -0
  93. package/dist/string/uppercase.d.ts +22 -0
  94. package/dist/string/uppercase.js +12 -0
  95. package/package.json +123 -0
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module string/camelcase
3
+ * @importTarget ./string/camelcase
4
+ * @author Hervé Perchec
5
+ */
6
+ /**
7
+ * Convert a string to camelcase
8
+ *
9
+ * ::: tip See also
10
+ * [lodash.camelcase](https://www.npmjs.com/package/lodash.camelcase) package documentation
11
+ * :::
12
+ * @param str - The string to camelcase
13
+ * @returns The "camelcased" string
14
+ * @envCompat Browser
15
+ * @envCompat Node
16
+ * @example
17
+ * camelcase('Foo Bar') // 'fooBar'
18
+ * camelcase('hello world') // 'helloWorld'
19
+ * camelcase('foo-bar') // 'fooBar'
20
+ */
21
+ export declare function camelcase(str: string): string;
22
+ export default camelcase;
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * juisy v3.0.0-beta.0
3
+ * Copyright © 2022-Present Hervé Perchec
4
+ */
5
+
6
+ import lodashCamelcase from 'lodash.camelcase';
7
+
8
+ function camelcase(str) {
9
+ return lodashCamelcase(str);
10
+ }
11
+
12
+ export { camelcase, camelcase as default };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @module string/capitalize
3
+ * @importTarget ./string/capitalize
4
+ * @author Hervé Perchec
5
+ */
6
+ /**
7
+ * Capitalize a string
8
+ *
9
+ * ::: tip See also
10
+ * [lodash.capitalize](https://www.npmjs.com/package/lodash.capitalize) package documentation
11
+ * :::
12
+ * @param str - The string to capitalize
13
+ * @param limit - The limit for substring to parse (-1: no limit, else int from 1 to X)
14
+ * @returns The "capitalized" string
15
+ * @envCompat Browser
16
+ * @envCompat Node
17
+ * @example
18
+ * capitalize('foo Bar') // 'Foo bar'
19
+ * capitalize('ping the IP Address', 1) // 'Ping the IP Address'
20
+ * capitalize('ping the IP Address', 11) // 'Ping the ip Address'
21
+ */
22
+ export declare function capitalize(str: string, limit?: number): string;
23
+ export default capitalize;
@@ -0,0 +1,18 @@
1
+ /*!
2
+ * juisy v3.0.0-beta.0
3
+ * Copyright © 2022-Present Hervé Perchec
4
+ */
5
+
6
+ import lodashCapitalize from 'lodash.capitalize';
7
+
8
+ function capitalize(str, limit = -1) {
9
+ let strToCapitalize = lodashCapitalize(str);
10
+ let remainder = "";
11
+ if (limit > 0) {
12
+ strToCapitalize = lodashCapitalize(str.substring(0, limit));
13
+ remainder = str.substring(limit, str.length);
14
+ }
15
+ return strToCapitalize + remainder;
16
+ }
17
+
18
+ export { capitalize, capitalize as default };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @module string/constantcase
3
+ * @importTarget ./string/constantcase
4
+ * @author Hervé Perchec
5
+ */
6
+ /**
7
+ * Converts a string to constantcase
8
+ * @param str - The string to constantcase
9
+ * @returns Returns the 'constantcased' string
10
+ * @envCompat Browser
11
+ * @envCompat Node
12
+ * @example
13
+ * constantcase('Foo Bar') // 'FOO_BAR'
14
+ */
15
+ export declare function constantcase(str: string): string;
16
+ export default constantcase;
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * juisy v3.0.0-beta.0
3
+ * Copyright © 2022-Present Hervé Perchec
4
+ */
5
+
6
+ import snakecase from '@juisy/utils/string/snakecase';
7
+
8
+ function constantcase(str) {
9
+ return snakecase(str).toUpperCase();
10
+ }
11
+
12
+ export { constantcase, constantcase as default };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module string/kebabcase
3
+ * @importTarget ./string/kebabcase
4
+ * @author Hervé Perchec
5
+ */
6
+ /**
7
+ * Convert a string to kebabcase
8
+ *
9
+ * ::: tip See also
10
+ * [lodash.kebabcase](https://www.npmjs.com/package/lodash.kebabcase) package documentation
11
+ * :::
12
+ * @param str - The string to kebabcase
13
+ * @returns Returns the "kebabcased" string
14
+ * @envCompat Browser
15
+ * @envCompat Node
16
+ * @example
17
+ * kebabcase('Foo Bar') // 'foo-bar'
18
+ * kebabcase('hello world') // 'hello-world'
19
+ * kebabcase('fooBar') // 'foo-bar'
20
+ */
21
+ export declare function kebabcase(str: string): string;
22
+ export default kebabcase;
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * juisy v3.0.0-beta.0
3
+ * Copyright © 2022-Present Hervé Perchec
4
+ */
5
+
6
+ import lodashKebabcase from 'lodash.kebabcase';
7
+
8
+ function kebabcase(str) {
9
+ return lodashKebabcase(str);
10
+ }
11
+
12
+ export { kebabcase as default, kebabcase };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module string/lowercase
3
+ * @importTarget ./string/lowercase
4
+ * @author Hervé Perchec
5
+ */
6
+ /**
7
+ * Converts string, as space separated words, to lower case.
8
+ *
9
+ * ::: tip See also
10
+ * [lodash.lowercase](https://www.npmjs.com/package/lodash.lowercase) package documentation
11
+ * :::
12
+ * @param str - The string to lowercase
13
+ * @returns The "lowercased" string
14
+ * @envCompat Browser
15
+ * @envCompat Node
16
+ * @example
17
+ * lowercase('Foo BAR') // 'foo bar'
18
+ * lowercase('HELLO WORLD') // 'hello world'
19
+ * lowercase('foo-Bar') // 'foo bar'
20
+ */
21
+ export declare function lowercase(str: string): string;
22
+ export default lowercase;
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * juisy v3.0.0-beta.0
3
+ * Copyright © 2022-Present Hervé Perchec
4
+ */
5
+
6
+ import lodashLowercase from 'lodash.lowercase';
7
+
8
+ function lowercase(str) {
9
+ return lodashLowercase(str);
10
+ }
11
+
12
+ export { lowercase as default, lowercase };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @module string/pascalcase
3
+ * @importTarget ./string/pascalcase
4
+ * @author Hervé Perchec
5
+ */
6
+ /**
7
+ * Convert a string to pascalcase
8
+ * @param str - The string to pascalcase
9
+ * @returns The "pascalcased" string
10
+ * @envCompat Browser
11
+ * @envCompat Node
12
+ * @example
13
+ * pascalcase('foo bar') // 'FooBar'
14
+ */
15
+ export declare function pascalcase(str: string): string;
16
+ export default pascalcase;
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * juisy v3.0.0-beta.0
3
+ * Copyright © 2022-Present Hervé Perchec
4
+ */
5
+
6
+ import camelcase from '@juisy/utils/string/camelcase';
7
+ import capitalize from '@juisy/utils/string/capitalize';
8
+
9
+ function pascalcase(str) {
10
+ return capitalize(camelcase(str), 1);
11
+ }
12
+
13
+ export { pascalcase as default, pascalcase };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module string/snakecase
3
+ * @importTarget ./string/snakecase
4
+ * @author Hervé Perchec
5
+ */
6
+ /**
7
+ * Convert a string to snakecase
8
+ *
9
+ * ::: tip See also
10
+ * [lodash.snakecase](https://www.npmjs.com/package/lodash.snakecase) package documentation
11
+ * :::
12
+ * @param str - The string to snakecase
13
+ * @returns The "snakecased" string
14
+ * @envCompat Browser
15
+ * @envCompat Node
16
+ * @example
17
+ * snakecase('Foo Bar') // 'foo_bar'
18
+ * snakecase('hello world') // 'hello_world'
19
+ * snakecase('fooBar') // 'foo_bar'
20
+ */
21
+ export declare function snakecase(str: string): string;
22
+ export default snakecase;
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * juisy v3.0.0-beta.0
3
+ * Copyright © 2022-Present Hervé Perchec
4
+ */
5
+
6
+ import lodashSnakecase from 'lodash.snakecase';
7
+
8
+ function snakecase(str) {
9
+ return lodashSnakecase(str);
10
+ }
11
+
12
+ export { snakecase as default, snakecase };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @module string/uppercase
3
+ * @importTarget ./string/uppercase
4
+ * @author Hervé Perchec
5
+ */
6
+ /**
7
+ * Converts string, as space separated words, to upper case.
8
+ *
9
+ * ::: tip See also
10
+ * [lodash.uppercase](https://www.npmjs.com/package/lodash.uppercase) package documentation
11
+ * :::
12
+ * @param str - The string to uppercase
13
+ * @returns The "uppercased" string
14
+ * @envCompat Browser
15
+ * @envCompat Node
16
+ * @example
17
+ * uppercase('foo bar') // 'FOO BAR'
18
+ * uppercase('hello world') // 'HELLO WORLD'
19
+ * uppercase('foo-Bar') // 'FOO BAR'
20
+ */
21
+ export declare function uppercase(str: string): string;
22
+ export default uppercase;
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * juisy v3.0.0-beta.0
3
+ * Copyright © 2022-Present Hervé Perchec
4
+ */
5
+
6
+ import lodashUppercase from 'lodash.uppercase';
7
+
8
+ function uppercase(str) {
9
+ return lodashUppercase(str);
10
+ }
11
+
12
+ export { uppercase as default, uppercase };
package/package.json ADDED
@@ -0,0 +1,123 @@
1
+ {
2
+ "name": "@juisy/utils",
3
+ "version": "3.0.0-beta.0",
4
+ "description": "Juisy utils",
5
+ "type": "module",
6
+ "files": [
7
+ "dist",
8
+ "LICENSE",
9
+ "README.md"
10
+ ],
11
+ "exports": {
12
+ "./assert/*": {
13
+ "types": "./dist/assert/*.d.ts",
14
+ "import": "./dist/assert/*.js"
15
+ },
16
+ "./constructor/*": {
17
+ "types": "./dist/constructor/*.d.ts",
18
+ "import": "./dist/constructor/*.js"
19
+ },
20
+ "./date/*": {
21
+ "types": "./dist/date/*.d.ts",
22
+ "import": "./dist/date/*.js"
23
+ },
24
+ "./fs/*": {
25
+ "types": "./dist/fs/*.d.ts",
26
+ "import": "./dist/fs/*.js"
27
+ },
28
+ "./is/*": {
29
+ "types": "./dist/is/*.d.ts",
30
+ "import": "./dist/is/*.js"
31
+ },
32
+ "./misc/*": {
33
+ "types": "./dist/misc/*.d.ts",
34
+ "import": "./dist/misc/*.js"
35
+ },
36
+ "./object/*": {
37
+ "types": "./dist/object/*.d.ts",
38
+ "import": "./dist/object/*.js"
39
+ },
40
+ "./path/*": {
41
+ "types": "./dist/path/*.d.ts",
42
+ "import": "./dist/path/*.js"
43
+ },
44
+ "./random/*": {
45
+ "types": "./dist/random/*.d.ts",
46
+ "import": "./dist/random/*.js"
47
+ },
48
+ "./string/*": {
49
+ "types": "./dist/string/*.d.ts",
50
+ "import": "./dist/string/*.js"
51
+ }
52
+ },
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "scripts": {
57
+ "build": "vite build",
58
+ "audit": "ncu && npm audit",
59
+ "audit:fix": "ncu --interactive",
60
+ "docs": "pnpm docs:readme && pnpm docs:api",
61
+ "docs:api": "pnpm root:cli docs generate:api -c ./docs/api/typedoc/typedoc.config.js -t ./docs/api/typedoc/tsconfig.typedoc.json",
62
+ "docs:readme": "pnpm root:cli docs generate:readme -c ./docs/readme/config.js",
63
+ "release": "release-it --no-increment",
64
+ "test": "vitest",
65
+ "test:dev": "npm test -- --watch",
66
+ "test:ui": "vitest --ui",
67
+ "root:cli": "node ../../bin/cli"
68
+ },
69
+ "repository": {
70
+ "type": "git",
71
+ "url": "git+https://gitlab.com/hperchec/juisy.git"
72
+ },
73
+ "keywords": [
74
+ "juisy",
75
+ "utils"
76
+ ],
77
+ "author": {
78
+ "name": "Hervé Perchec",
79
+ "email": "contact@herve-perchec.com",
80
+ "url": "https://gitlab.com/herveperchec"
81
+ },
82
+ "license": "GPL-3.0-only",
83
+ "bugs": {
84
+ "url": "https://gitlab.com/hperchec/juisy/issues"
85
+ },
86
+ "homepage": "https://hperchec.gitlab.io/juisy",
87
+ "devDependencies": {
88
+ "@types/fs-extra": "^11.0.4",
89
+ "@types/lodash.camelcase": "^4.3.9",
90
+ "@types/lodash.capitalize": "^4.2.9",
91
+ "@types/lodash.get": "^4.4.9",
92
+ "@types/lodash.kebabcase": "^4.1.9",
93
+ "@types/lodash.lowercase": "^4.3.9",
94
+ "@types/lodash.random": "^3.2.9",
95
+ "@types/lodash.samplesize": "^4.2.9",
96
+ "@types/lodash.snakecase": "^4.1.9",
97
+ "@types/lodash.uppercase": "^4.3.9",
98
+ "csstype": "^3.2.3"
99
+ },
100
+ "dependencies": {
101
+ "@sindresorhus/is": "^7",
102
+ "deepmerge": "^4.3.1",
103
+ "detect-browser-es": "^0.1.1",
104
+ "error-stack-parser": "^2.1.4",
105
+ "fs-extra": "^11.2.0",
106
+ "glob": "^11.0.0",
107
+ "lodash.camelcase": "^4.3.0",
108
+ "lodash.capitalize": "^4.2.1",
109
+ "lodash.get": "^4.4.2",
110
+ "lodash.kebabcase": "^4.1.1",
111
+ "lodash.lowercase": "^4.3.0",
112
+ "lodash.random": "^3.2.0",
113
+ "lodash.samplesize": "^4.2.0",
114
+ "lodash.snakecase": "^4.1.1",
115
+ "lodash.uppercase": "^4.3.0",
116
+ "ow": "^2.0.0",
117
+ "pkg-dir": "^8.0.0",
118
+ "juisy_utils_scoped_dayjs": "npm:dayjs@^1.11.21"
119
+ },
120
+ "release-it": {
121
+ "git": false
122
+ }
123
+ }