radashi 12.9.1 → 12.9.3
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/dist/radashi.cjs +13 -18
- package/dist/radashi.js +13 -18
- package/package.json +1 -1
package/dist/radashi.cjs
CHANGED
|
@@ -72,17 +72,15 @@ function concat(...values) {
|
|
|
72
72
|
|
|
73
73
|
// src/array/counting.ts
|
|
74
74
|
function counting(array, identity2) {
|
|
75
|
+
const counts = /* @__PURE__ */ Object.create(null);
|
|
75
76
|
if (!array) {
|
|
76
|
-
return
|
|
77
|
+
return counts;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
{}
|
|
85
|
-
);
|
|
79
|
+
for (const item of array) {
|
|
80
|
+
const id = identity2(item);
|
|
81
|
+
counts[id] = (counts[id] ?? 0) + 1;
|
|
82
|
+
}
|
|
83
|
+
return counts;
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
// src/array/diff.ts
|
|
@@ -96,14 +94,11 @@ function diff(root, other, identity2 = (t) => t) {
|
|
|
96
94
|
if (!(other == null ? void 0 : other.length)) {
|
|
97
95
|
return [...root];
|
|
98
96
|
}
|
|
99
|
-
const bKeys =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{}
|
|
105
|
-
);
|
|
106
|
-
return root.filter((a) => !bKeys[identity2(a)]);
|
|
97
|
+
const bKeys = /* @__PURE__ */ new Set();
|
|
98
|
+
for (const item of other) {
|
|
99
|
+
bKeys.add(identity2(item));
|
|
100
|
+
}
|
|
101
|
+
return root.filter((a) => !bKeys.has(identity2(a)));
|
|
107
102
|
}
|
|
108
103
|
|
|
109
104
|
// src/array/first.ts
|
|
@@ -1926,7 +1921,7 @@ function snake(str, options) {
|
|
|
1926
1921
|
const result = parts.reduce((acc, part) => {
|
|
1927
1922
|
return `${acc}_${part.toLowerCase()}`;
|
|
1928
1923
|
});
|
|
1929
|
-
return (options == null ? void 0 : options.splitOnNumber) === false ? result : result.replace(/([A-Za-z]{1}[0-9]{1})
|
|
1924
|
+
return (options == null ? void 0 : options.splitOnNumber) === false ? result : result.replace(/([A-Za-z]{1}[0-9]{1})/g, (val) => `${val[0]}_${val[1]}`);
|
|
1930
1925
|
}
|
|
1931
1926
|
|
|
1932
1927
|
// src/string/template.ts
|
package/dist/radashi.js
CHANGED
|
@@ -70,17 +70,15 @@ function concat(...values) {
|
|
|
70
70
|
|
|
71
71
|
// src/array/counting.ts
|
|
72
72
|
function counting(array, identity2) {
|
|
73
|
+
const counts = /* @__PURE__ */ Object.create(null);
|
|
73
74
|
if (!array) {
|
|
74
|
-
return
|
|
75
|
+
return counts;
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
-
(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
{}
|
|
83
|
-
);
|
|
77
|
+
for (const item of array) {
|
|
78
|
+
const id = identity2(item);
|
|
79
|
+
counts[id] = (counts[id] ?? 0) + 1;
|
|
80
|
+
}
|
|
81
|
+
return counts;
|
|
84
82
|
}
|
|
85
83
|
|
|
86
84
|
// src/array/diff.ts
|
|
@@ -94,14 +92,11 @@ function diff(root, other, identity2 = (t) => t) {
|
|
|
94
92
|
if (!(other == null ? void 0 : other.length)) {
|
|
95
93
|
return [...root];
|
|
96
94
|
}
|
|
97
|
-
const bKeys =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
{}
|
|
103
|
-
);
|
|
104
|
-
return root.filter((a) => !bKeys[identity2(a)]);
|
|
95
|
+
const bKeys = /* @__PURE__ */ new Set();
|
|
96
|
+
for (const item of other) {
|
|
97
|
+
bKeys.add(identity2(item));
|
|
98
|
+
}
|
|
99
|
+
return root.filter((a) => !bKeys.has(identity2(a)));
|
|
105
100
|
}
|
|
106
101
|
|
|
107
102
|
// src/array/first.ts
|
|
@@ -1924,7 +1919,7 @@ function snake(str, options) {
|
|
|
1924
1919
|
const result = parts.reduce((acc, part) => {
|
|
1925
1920
|
return `${acc}_${part.toLowerCase()}`;
|
|
1926
1921
|
});
|
|
1927
|
-
return (options == null ? void 0 : options.splitOnNumber) === false ? result : result.replace(/([A-Za-z]{1}[0-9]{1})
|
|
1922
|
+
return (options == null ? void 0 : options.splitOnNumber) === false ? result : result.replace(/([A-Za-z]{1}[0-9]{1})/g, (val) => `${val[0]}_${val[1]}`);
|
|
1928
1923
|
}
|
|
1929
1924
|
|
|
1930
1925
|
// src/string/template.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "radashi",
|
|
3
|
-
"version": "12.9.
|
|
3
|
+
"version": "12.9.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The modern, community-first TypeScript toolkit with all of the fast, readable, and minimal utility functions you need. Type-safe, dependency-free, tree-shakeable, fully tested.",
|
|
6
6
|
"repository": {
|