@applicaster/zapp-react-native-utils 13.0.0-alpha.2685746452 → 13.0.0-alpha.2807014304
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/dateUtils/index.ts +0 -2
- package/package.json +2 -2
- package/utils/README.md +0 -34
- package/utils/clone.ts +0 -56
- package/utils/flatten.ts +0 -3
- package/utils/index.ts +0 -7
- package/utils/splitEvery.ts +0 -27
- package/utils/times.ts +0 -2
package/dateUtils/index.ts
CHANGED
|
@@ -2,12 +2,10 @@ import dayjs from "dayjs";
|
|
|
2
2
|
import utc from "dayjs/plugin/utc";
|
|
3
3
|
import timezone from "dayjs/plugin/timezone";
|
|
4
4
|
import isoWeek from "dayjs/plugin/isoWeek";
|
|
5
|
-
import duration from "dayjs/plugin/duration";
|
|
6
5
|
|
|
7
6
|
// Extend dayjs with plugins
|
|
8
7
|
dayjs.extend(utc);
|
|
9
8
|
dayjs.extend(timezone);
|
|
10
9
|
dayjs.extend(isoWeek);
|
|
11
|
-
dayjs.extend(duration);
|
|
12
10
|
|
|
13
11
|
export { dayjs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.2807014304",
|
|
4
4
|
"description": "Applicaster Zapp React Native utilities package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@applicaster/applicaster-types": "13.0.0-alpha.
|
|
30
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.2807014304",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|
package/utils/README.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
### ramda replacement utils
|
|
2
|
-
|
|
3
|
-
See contribution guide below
|
|
4
|
-
|
|
5
|
-
## Reference
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### _.flatten
|
|
9
|
-
R.times => flatten.ts
|
|
10
|
-
|
|
11
|
-
### _.times
|
|
12
|
-
R.times => times.ts
|
|
13
|
-
|
|
14
|
-
### _.drop
|
|
15
|
-
R.drop(N,array) => array.slice(N)
|
|
16
|
-
|
|
17
|
-
### _.clone
|
|
18
|
-
R.clone => clone.ts
|
|
19
|
-
|
|
20
|
-
### _.splitEvery
|
|
21
|
-
R.splitEvery => splitEvery.ts
|
|
22
|
-
|
|
23
|
-
### _.length
|
|
24
|
-
R.length(data) => data?.length ?? 0
|
|
25
|
-
|
|
26
|
-
## Contribution
|
|
27
|
-
|
|
28
|
-
To add new helper function
|
|
29
|
-
|
|
30
|
-
1. Search for replacement ( you can reuse lodash, preferable pure JS solution), arguments should match with Ramda definition
|
|
31
|
-
2. Add new file, update exports in index file
|
|
32
|
-
3. If replacement is simple enough that doesn't need a function - add snippet to this README
|
|
33
|
-
4. Make sure README is updated and contains reference for newly added function
|
|
34
|
-
5. Write unit test to test input/output. You can use AI's help.
|
package/utils/clone.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates a deep copy of the value which may contain (nested) `Array`s and `Object`s,
|
|
3
|
-
* `Number`s, `String`s, `Boolean`s and `Date`s. `Function`s are assigned by reference
|
|
4
|
-
* rather than copied. Dispatches to a `clone` method if present.
|
|
5
|
-
*
|
|
6
|
-
* @param {*} value - The value to clone
|
|
7
|
-
* @return {*} A deep copy of the provided value
|
|
8
|
-
*/
|
|
9
|
-
export const clone = (value) => {
|
|
10
|
-
// Handle null or undefined
|
|
11
|
-
if (value == null) {
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Check if value has a custom clone method
|
|
16
|
-
if (typeof value.clone === "function") {
|
|
17
|
-
return value.clone();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Handle primitive types (they're immutable so no need to clone)
|
|
21
|
-
if (typeof value !== "object") {
|
|
22
|
-
return value;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Handle Date objects
|
|
26
|
-
if (value instanceof Date) {
|
|
27
|
-
return new Date(value.getTime());
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Handle RegExp objects
|
|
31
|
-
if (value instanceof RegExp) {
|
|
32
|
-
return new RegExp(value.source, value.flags);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Handle Array objects
|
|
36
|
-
if (Array.isArray(value)) {
|
|
37
|
-
return value.map((item) => clone(item));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Handle Object literals
|
|
41
|
-
if (Object.prototype.toString.call(value) === "[object Object]") {
|
|
42
|
-
const result = {};
|
|
43
|
-
const keys = Object.keys(value);
|
|
44
|
-
|
|
45
|
-
for (let i = 0; i < keys.length; i++) {
|
|
46
|
-
const key = keys[i];
|
|
47
|
-
result[key] = clone(value[key]);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return result;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// For other types like Maps, Sets, etc., we would need additional handling
|
|
54
|
-
// For simplicity, we'll return the original value for unsupported types
|
|
55
|
-
return value;
|
|
56
|
-
};
|
package/utils/flatten.ts
DELETED
package/utils/index.ts
DELETED
package/utils/splitEvery.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export function splitEvery(size, collection) {
|
|
2
|
-
if (size <= 0) {
|
|
3
|
-
throw new Error("First argument to splitEvery must be a positive integer");
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const result = [];
|
|
7
|
-
|
|
8
|
-
// Handle string input
|
|
9
|
-
if (typeof collection === "string") {
|
|
10
|
-
for (let i = 0; i < collection.length; i += size) {
|
|
11
|
-
result.push(collection.slice(i, i + size));
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Handle array input
|
|
18
|
-
if (Array.isArray(collection)) {
|
|
19
|
-
for (let i = 0; i < collection.length; i += size) {
|
|
20
|
-
result.push(collection.slice(i, i + size));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return result;
|
|
27
|
-
}
|
package/utils/times.ts
DELETED