@jswork/utils 1.0.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 (73) hide show
  1. package/README.md +7 -0
  2. package/dist/index.cjs +745 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +10 -0
  5. package/dist/index.d.ts +10 -0
  6. package/dist/index.js +12 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/toolkit/array.cjs +268 -0
  9. package/dist/toolkit/array.cjs.map +1 -0
  10. package/dist/toolkit/array.d.cts +10 -0
  11. package/dist/toolkit/array.d.ts +10 -0
  12. package/dist/toolkit/array.js +3 -0
  13. package/dist/toolkit/array.js.map +1 -0
  14. package/dist/toolkit/compat.cjs +16 -0
  15. package/dist/toolkit/compat.cjs.map +1 -0
  16. package/dist/toolkit/compat.d.cts +1 -0
  17. package/dist/toolkit/compat.d.ts +1 -0
  18. package/dist/toolkit/compat.js +3 -0
  19. package/dist/toolkit/compat.js.map +1 -0
  20. package/dist/toolkit/function.cjs +92 -0
  21. package/dist/toolkit/function.cjs.map +1 -0
  22. package/dist/toolkit/function.d.cts +1 -0
  23. package/dist/toolkit/function.d.ts +1 -0
  24. package/dist/toolkit/function.js +3 -0
  25. package/dist/toolkit/function.js.map +1 -0
  26. package/dist/toolkit/math.cjs +60 -0
  27. package/dist/toolkit/math.cjs.map +1 -0
  28. package/dist/toolkit/math.d.cts +1 -0
  29. package/dist/toolkit/math.d.ts +1 -0
  30. package/dist/toolkit/math.js +3 -0
  31. package/dist/toolkit/math.js.map +1 -0
  32. package/dist/toolkit/object.cjs +76 -0
  33. package/dist/toolkit/object.cjs.map +1 -0
  34. package/dist/toolkit/object.d.cts +1 -0
  35. package/dist/toolkit/object.d.ts +1 -0
  36. package/dist/toolkit/object.js +3 -0
  37. package/dist/toolkit/object.js.map +1 -0
  38. package/dist/toolkit/predicate.cjs +136 -0
  39. package/dist/toolkit/predicate.cjs.map +1 -0
  40. package/dist/toolkit/predicate.d.cts +1 -0
  41. package/dist/toolkit/predicate.d.ts +1 -0
  42. package/dist/toolkit/predicate.js +3 -0
  43. package/dist/toolkit/predicate.js.map +1 -0
  44. package/dist/toolkit/promise.cjs +28 -0
  45. package/dist/toolkit/promise.cjs.map +1 -0
  46. package/dist/toolkit/promise.d.cts +1 -0
  47. package/dist/toolkit/promise.d.ts +1 -0
  48. package/dist/toolkit/promise.js +3 -0
  49. package/dist/toolkit/promise.js.map +1 -0
  50. package/dist/toolkit/string.cjs +92 -0
  51. package/dist/toolkit/string.cjs.map +1 -0
  52. package/dist/toolkit/string.d.cts +1 -0
  53. package/dist/toolkit/string.d.ts +1 -0
  54. package/dist/toolkit/string.js +3 -0
  55. package/dist/toolkit/string.js.map +1 -0
  56. package/dist/toolkit/util.cjs +24 -0
  57. package/dist/toolkit/util.cjs.map +1 -0
  58. package/dist/toolkit/util.d.cts +1 -0
  59. package/dist/toolkit/util.d.ts +1 -0
  60. package/dist/toolkit/util.js +3 -0
  61. package/dist/toolkit/util.js.map +1 -0
  62. package/package.json +37 -0
  63. package/src/index.ts +12 -0
  64. package/src/toolkit/array.ts +67 -0
  65. package/src/toolkit/compat.ts +300 -0
  66. package/src/toolkit/error.ts +4 -0
  67. package/src/toolkit/function.ts +23 -0
  68. package/src/toolkit/math.ts +15 -0
  69. package/src/toolkit/object.ts +19 -0
  70. package/src/toolkit/predicate.ts +34 -0
  71. package/src/toolkit/promise.ts +7 -0
  72. package/src/toolkit/string.ts +23 -0
  73. package/src/toolkit/util.ts +6 -0
@@ -0,0 +1,3 @@
1
+ export { clone, cloneDeep, cloneDeepWith, findKey, flattenObject, invert, mapKeys, mapValues, merge, mergeWith, omit, omitBy, pick, pickBy, toCamelCaseKeys, toMerged, toSnakeCaseKeys } from 'es-toolkit/object';
2
+ //# sourceMappingURL=object.js.map
3
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"object.js","sourcesContent":[]}
@@ -0,0 +1,136 @@
1
+ 'use strict';
2
+
3
+ var predicate = require('es-toolkit/predicate');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "isArrayBuffer", {
8
+ enumerable: true,
9
+ get: function () { return predicate.isArrayBuffer; }
10
+ });
11
+ Object.defineProperty(exports, "isBlob", {
12
+ enumerable: true,
13
+ get: function () { return predicate.isBlob; }
14
+ });
15
+ Object.defineProperty(exports, "isBoolean", {
16
+ enumerable: true,
17
+ get: function () { return predicate.isBoolean; }
18
+ });
19
+ Object.defineProperty(exports, "isBrowser", {
20
+ enumerable: true,
21
+ get: function () { return predicate.isBrowser; }
22
+ });
23
+ Object.defineProperty(exports, "isBuffer", {
24
+ enumerable: true,
25
+ get: function () { return predicate.isBuffer; }
26
+ });
27
+ Object.defineProperty(exports, "isDate", {
28
+ enumerable: true,
29
+ get: function () { return predicate.isDate; }
30
+ });
31
+ Object.defineProperty(exports, "isEqual", {
32
+ enumerable: true,
33
+ get: function () { return predicate.isEqual; }
34
+ });
35
+ Object.defineProperty(exports, "isEqualWith", {
36
+ enumerable: true,
37
+ get: function () { return predicate.isEqualWith; }
38
+ });
39
+ Object.defineProperty(exports, "isError", {
40
+ enumerable: true,
41
+ get: function () { return predicate.isError; }
42
+ });
43
+ Object.defineProperty(exports, "isFile", {
44
+ enumerable: true,
45
+ get: function () { return predicate.isFile; }
46
+ });
47
+ Object.defineProperty(exports, "isFunction", {
48
+ enumerable: true,
49
+ get: function () { return predicate.isFunction; }
50
+ });
51
+ Object.defineProperty(exports, "isJSON", {
52
+ enumerable: true,
53
+ get: function () { return predicate.isJSON; }
54
+ });
55
+ Object.defineProperty(exports, "isJSONArray", {
56
+ enumerable: true,
57
+ get: function () { return predicate.isJSONArray; }
58
+ });
59
+ Object.defineProperty(exports, "isJSONObject", {
60
+ enumerable: true,
61
+ get: function () { return predicate.isJSONObject; }
62
+ });
63
+ Object.defineProperty(exports, "isJSONValue", {
64
+ enumerable: true,
65
+ get: function () { return predicate.isJSONValue; }
66
+ });
67
+ Object.defineProperty(exports, "isLength", {
68
+ enumerable: true,
69
+ get: function () { return predicate.isLength; }
70
+ });
71
+ Object.defineProperty(exports, "isMap", {
72
+ enumerable: true,
73
+ get: function () { return predicate.isMap; }
74
+ });
75
+ Object.defineProperty(exports, "isNil", {
76
+ enumerable: true,
77
+ get: function () { return predicate.isNil; }
78
+ });
79
+ Object.defineProperty(exports, "isNode", {
80
+ enumerable: true,
81
+ get: function () { return predicate.isNode; }
82
+ });
83
+ Object.defineProperty(exports, "isNotNil", {
84
+ enumerable: true,
85
+ get: function () { return predicate.isNotNil; }
86
+ });
87
+ Object.defineProperty(exports, "isNull", {
88
+ enumerable: true,
89
+ get: function () { return predicate.isNull; }
90
+ });
91
+ Object.defineProperty(exports, "isPlainObject", {
92
+ enumerable: true,
93
+ get: function () { return predicate.isPlainObject; }
94
+ });
95
+ Object.defineProperty(exports, "isPrimitive", {
96
+ enumerable: true,
97
+ get: function () { return predicate.isPrimitive; }
98
+ });
99
+ Object.defineProperty(exports, "isPromise", {
100
+ enumerable: true,
101
+ get: function () { return predicate.isPromise; }
102
+ });
103
+ Object.defineProperty(exports, "isRegExp", {
104
+ enumerable: true,
105
+ get: function () { return predicate.isRegExp; }
106
+ });
107
+ Object.defineProperty(exports, "isSet", {
108
+ enumerable: true,
109
+ get: function () { return predicate.isSet; }
110
+ });
111
+ Object.defineProperty(exports, "isString", {
112
+ enumerable: true,
113
+ get: function () { return predicate.isString; }
114
+ });
115
+ Object.defineProperty(exports, "isSymbol", {
116
+ enumerable: true,
117
+ get: function () { return predicate.isSymbol; }
118
+ });
119
+ Object.defineProperty(exports, "isTypedArray", {
120
+ enumerable: true,
121
+ get: function () { return predicate.isTypedArray; }
122
+ });
123
+ Object.defineProperty(exports, "isUndefined", {
124
+ enumerable: true,
125
+ get: function () { return predicate.isUndefined; }
126
+ });
127
+ Object.defineProperty(exports, "isWeakMap", {
128
+ enumerable: true,
129
+ get: function () { return predicate.isWeakMap; }
130
+ });
131
+ Object.defineProperty(exports, "isWeakSet", {
132
+ enumerable: true,
133
+ get: function () { return predicate.isWeakSet; }
134
+ });
135
+ //# sourceMappingURL=predicate.cjs.map
136
+ //# sourceMappingURL=predicate.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"predicate.cjs","sourcesContent":[]}
@@ -0,0 +1 @@
1
+ export { isArrayBuffer, isBlob, isBoolean, isBrowser, isBuffer, isDate, isEqual, isEqualWith, isError, isFile, isFunction, isJSON, isJSONArray, isJSONObject, isJSONValue, isLength, isMap, isNil, isNode, isNotNil, isNull, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet } from 'es-toolkit/predicate';
@@ -0,0 +1 @@
1
+ export { isArrayBuffer, isBlob, isBoolean, isBrowser, isBuffer, isDate, isEqual, isEqualWith, isError, isFile, isFunction, isJSON, isJSONArray, isJSONObject, isJSONValue, isLength, isMap, isNil, isNode, isNotNil, isNull, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet } from 'es-toolkit/predicate';
@@ -0,0 +1,3 @@
1
+ export { isArrayBuffer, isBlob, isBoolean, isBrowser, isBuffer, isDate, isEqual, isEqualWith, isError, isFile, isFunction, isJSON, isJSONArray, isJSONObject, isJSONValue, isLength, isMap, isNil, isNode, isNotNil, isNull, isPlainObject, isPrimitive, isPromise, isRegExp, isSet, isString, isSymbol, isTypedArray, isUndefined, isWeakMap, isWeakSet } from 'es-toolkit/predicate';
2
+ //# sourceMappingURL=predicate.js.map
3
+ //# sourceMappingURL=predicate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"predicate.js","sourcesContent":[]}
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var promise = require('es-toolkit/promise');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "Mutex", {
8
+ enumerable: true,
9
+ get: function () { return promise.Mutex; }
10
+ });
11
+ Object.defineProperty(exports, "Semaphore", {
12
+ enumerable: true,
13
+ get: function () { return promise.Semaphore; }
14
+ });
15
+ Object.defineProperty(exports, "delay", {
16
+ enumerable: true,
17
+ get: function () { return promise.delay; }
18
+ });
19
+ Object.defineProperty(exports, "timeout", {
20
+ enumerable: true,
21
+ get: function () { return promise.timeout; }
22
+ });
23
+ Object.defineProperty(exports, "withTimeout", {
24
+ enumerable: true,
25
+ get: function () { return promise.withTimeout; }
26
+ });
27
+ //# sourceMappingURL=promise.cjs.map
28
+ //# sourceMappingURL=promise.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"promise.cjs","sourcesContent":[]}
@@ -0,0 +1 @@
1
+ export { Mutex, Semaphore, delay, timeout, withTimeout } from 'es-toolkit/promise';
@@ -0,0 +1 @@
1
+ export { Mutex, Semaphore, delay, timeout, withTimeout } from 'es-toolkit/promise';
@@ -0,0 +1,3 @@
1
+ export { Mutex, Semaphore, delay, timeout, withTimeout } from 'es-toolkit/promise';
2
+ //# sourceMappingURL=promise.js.map
3
+ //# sourceMappingURL=promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"promise.js","sourcesContent":[]}
@@ -0,0 +1,92 @@
1
+ 'use strict';
2
+
3
+ var string = require('es-toolkit/string');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "camelCase", {
8
+ enumerable: true,
9
+ get: function () { return string.camelCase; }
10
+ });
11
+ Object.defineProperty(exports, "capitalize", {
12
+ enumerable: true,
13
+ get: function () { return string.capitalize; }
14
+ });
15
+ Object.defineProperty(exports, "constantCase", {
16
+ enumerable: true,
17
+ get: function () { return string.constantCase; }
18
+ });
19
+ Object.defineProperty(exports, "deburr", {
20
+ enumerable: true,
21
+ get: function () { return string.deburr; }
22
+ });
23
+ Object.defineProperty(exports, "escape", {
24
+ enumerable: true,
25
+ get: function () { return string.escape; }
26
+ });
27
+ Object.defineProperty(exports, "escapeRegExp", {
28
+ enumerable: true,
29
+ get: function () { return string.escapeRegExp; }
30
+ });
31
+ Object.defineProperty(exports, "kebabCase", {
32
+ enumerable: true,
33
+ get: function () { return string.kebabCase; }
34
+ });
35
+ Object.defineProperty(exports, "lowerCase", {
36
+ enumerable: true,
37
+ get: function () { return string.lowerCase; }
38
+ });
39
+ Object.defineProperty(exports, "lowerFirst", {
40
+ enumerable: true,
41
+ get: function () { return string.lowerFirst; }
42
+ });
43
+ Object.defineProperty(exports, "pad", {
44
+ enumerable: true,
45
+ get: function () { return string.pad; }
46
+ });
47
+ Object.defineProperty(exports, "pascalCase", {
48
+ enumerable: true,
49
+ get: function () { return string.pascalCase; }
50
+ });
51
+ Object.defineProperty(exports, "reverseString", {
52
+ enumerable: true,
53
+ get: function () { return string.reverseString; }
54
+ });
55
+ Object.defineProperty(exports, "snakeCase", {
56
+ enumerable: true,
57
+ get: function () { return string.snakeCase; }
58
+ });
59
+ Object.defineProperty(exports, "startCase", {
60
+ enumerable: true,
61
+ get: function () { return string.startCase; }
62
+ });
63
+ Object.defineProperty(exports, "trim", {
64
+ enumerable: true,
65
+ get: function () { return string.trim; }
66
+ });
67
+ Object.defineProperty(exports, "trimEnd", {
68
+ enumerable: true,
69
+ get: function () { return string.trimEnd; }
70
+ });
71
+ Object.defineProperty(exports, "trimStart", {
72
+ enumerable: true,
73
+ get: function () { return string.trimStart; }
74
+ });
75
+ Object.defineProperty(exports, "unescape", {
76
+ enumerable: true,
77
+ get: function () { return string.unescape; }
78
+ });
79
+ Object.defineProperty(exports, "upperCase", {
80
+ enumerable: true,
81
+ get: function () { return string.upperCase; }
82
+ });
83
+ Object.defineProperty(exports, "upperFirst", {
84
+ enumerable: true,
85
+ get: function () { return string.upperFirst; }
86
+ });
87
+ Object.defineProperty(exports, "words", {
88
+ enumerable: true,
89
+ get: function () { return string.words; }
90
+ });
91
+ //# sourceMappingURL=string.cjs.map
92
+ //# sourceMappingURL=string.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"string.cjs","sourcesContent":[]}
@@ -0,0 +1 @@
1
+ export { camelCase, capitalize, constantCase, deburr, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from 'es-toolkit/string';
@@ -0,0 +1 @@
1
+ export { camelCase, capitalize, constantCase, deburr, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from 'es-toolkit/string';
@@ -0,0 +1,3 @@
1
+ export { camelCase, capitalize, constantCase, deburr, escape, escapeRegExp, kebabCase, lowerCase, lowerFirst, pad, pascalCase, reverseString, snakeCase, startCase, trim, trimEnd, trimStart, unescape, upperCase, upperFirst, words } from 'es-toolkit/string';
2
+ //# sourceMappingURL=string.js.map
3
+ //# sourceMappingURL=string.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"string.js","sourcesContent":[]}
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var util = require('es-toolkit/util');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "assert", {
8
+ enumerable: true,
9
+ get: function () { return util.assert; }
10
+ });
11
+ Object.defineProperty(exports, "attempt", {
12
+ enumerable: true,
13
+ get: function () { return util.attempt; }
14
+ });
15
+ Object.defineProperty(exports, "attemptAsync", {
16
+ enumerable: true,
17
+ get: function () { return util.attemptAsync; }
18
+ });
19
+ Object.defineProperty(exports, "invariant", {
20
+ enumerable: true,
21
+ get: function () { return util.invariant; }
22
+ });
23
+ //# sourceMappingURL=util.cjs.map
24
+ //# sourceMappingURL=util.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"util.cjs","sourcesContent":[]}
@@ -0,0 +1 @@
1
+ export { assert, attempt, attemptAsync, invariant } from 'es-toolkit/util';
@@ -0,0 +1 @@
1
+ export { assert, attempt, attemptAsync, invariant } from 'es-toolkit/util';
@@ -0,0 +1,3 @@
1
+ export { assert, attempt, attemptAsync, invariant } from 'es-toolkit/util';
2
+ //# sourceMappingURL=util.js.map
3
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"util.js","sourcesContent":[]}
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@jswork/utils",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Cross-platform JavaScript utilities, safely usable in any runtime.",
6
+ "license": "MIT",
7
+ "main": "dist/index.cjs",
8
+ "module": "dist/index.js",
9
+ "files": [
10
+ "dist",
11
+ "src"
12
+ ],
13
+ "scripts": {
14
+ "build": "tsup",
15
+ "test": "vitest run",
16
+ "release": "release-it",
17
+ "test:watch": "vitest",
18
+ "gen:toolkit": "tsx scripts/generate-es-toolkit.ts"
19
+ },
20
+ "sideEffects": false,
21
+ "types": "./dist/index.d.ts",
22
+ "devDependencies": {
23
+ "@types/node": "^22.10.5",
24
+ "globby": "^16.1.0",
25
+ "tsup": "^8.5.1",
26
+ "tsx": "^4.21.0",
27
+ "typescript": "^5.9.3",
28
+ "vitest": "^4.0.16"
29
+ },
30
+ "dependencies": {
31
+ "es-toolkit": "^1.43.0"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public",
35
+ "registry": "https://registry.npmjs.org/"
36
+ }
37
+ }
package/src/index.ts ADDED
@@ -0,0 +1,12 @@
1
+ export * from './toolkit/array';
2
+ export * from './toolkit/object';
3
+ export * from './toolkit/function';
4
+ export * from './toolkit/math';
5
+ export * from './toolkit/object';
6
+ export * from './toolkit/predicate';
7
+ export * from './toolkit/promise';
8
+ export * from './toolkit/promise';
9
+ export * from './toolkit/string';
10
+ export * from './toolkit/util';
11
+ export * from './toolkit/error';
12
+ export * from './toolkit/compat';
@@ -0,0 +1,67 @@
1
+ export {
2
+ at,
3
+ chunk,
4
+ countBy,
5
+ difference,
6
+ differenceBy,
7
+ differenceWith,
8
+ drop,
9
+ dropRight,
10
+ dropRightWhile,
11
+ dropWhile,
12
+ fill,
13
+ filterAsync,
14
+ flatMap,
15
+ flatMapAsync,
16
+ flatMapDeep,
17
+ flatten,
18
+ flattenDeep,
19
+ forEachAsync,
20
+ forEachRight,
21
+ groupBy,
22
+ head,
23
+ initial,
24
+ intersection,
25
+ intersectionBy,
26
+ intersectionWith,
27
+ isSubset,
28
+ isSubsetWith,
29
+ keyBy,
30
+ last,
31
+ limitAsync,
32
+ mapAsync,
33
+ maxBy,
34
+ minBy,
35
+ orderBy,
36
+ partition,
37
+ pull,
38
+ pullAt,
39
+ reduceAsync,
40
+ remove,
41
+ sample,
42
+ sampleSize,
43
+ shuffle,
44
+ sortBy,
45
+ tail,
46
+ take,
47
+ takeRight,
48
+ takeRightWhile,
49
+ takeWhile,
50
+ toFilled,
51
+ union,
52
+ unionBy,
53
+ unionWith,
54
+ uniq,
55
+ uniqBy,
56
+ uniqWith,
57
+ unzip,
58
+ unzipWith,
59
+ windowed,
60
+ without,
61
+ xor,
62
+ xorBy,
63
+ xorWith,
64
+ zip,
65
+ zipObject,
66
+ zipWith
67
+ } from 'es-toolkit/array';