@kato-lee/utilities 1.0.1 → 2.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 (43) hide show
  1. package/fesm2022/kato-lee-utilities-models.mjs +69 -0
  2. package/fesm2022/kato-lee-utilities-models.mjs.map +1 -0
  3. package/fesm2022/kato-lee-utilities-pipes.mjs +149 -0
  4. package/fesm2022/kato-lee-utilities-pipes.mjs.map +1 -0
  5. package/fesm2022/kato-lee-utilities-services.mjs +276 -0
  6. package/fesm2022/kato-lee-utilities-services.mjs.map +1 -0
  7. package/fesm2022/kato-lee-utilities-types.mjs +65 -0
  8. package/fesm2022/kato-lee-utilities-types.mjs.map +1 -0
  9. package/fesm2022/kato-lee-utilities-validators.mjs +20 -0
  10. package/fesm2022/kato-lee-utilities-validators.mjs.map +1 -0
  11. package/fesm2022/kato-lee-utilities.mjs +1 -18
  12. package/fesm2022/kato-lee-utilities.mjs.map +1 -1
  13. package/index.d.ts +94 -5
  14. package/js/_clone-deep.js +826 -826
  15. package/js/_order-by.js +1287 -1287
  16. package/js/index.js +2 -2
  17. package/models/index.d.ts +32 -0
  18. package/models/package.json +3 -0
  19. package/package.json +25 -3
  20. package/pipes/index.d.ts +51 -0
  21. package/pipes/package.json +3 -0
  22. package/services/index.d.ts +56 -0
  23. package/services/package.json +3 -0
  24. package/types/index.d.ts +36 -0
  25. package/types/package.json +3 -0
  26. package/validators/index.d.ts +16 -0
  27. package/validators/package.json +3 -0
  28. package/_either.d.ts +0 -12
  29. package/_group-by-key.d.ts +0 -6
  30. package/_lodash.d.ts +0 -71
  31. package/_path.d.ts +0 -1
  32. package/_types.d.ts +0 -14
  33. package/esm2022/_either.mjs +0 -49
  34. package/esm2022/_group-by-key.mjs +0 -19
  35. package/esm2022/_lodash.mjs +0 -91
  36. package/esm2022/_path.mjs +0 -17
  37. package/esm2022/_types.mjs +0 -17
  38. package/esm2022/index.mjs +0 -9
  39. package/esm2022/js/_clone-deep.mjs +0 -619
  40. package/esm2022/js/_order-by.mjs +0 -948
  41. package/esm2022/kato-lee-utilities.mjs +0 -5
  42. package/js/_clone-deep.d.ts +0 -2
  43. package/js/_order-by.d.ts +0 -2
package/index.d.ts CHANGED
@@ -1,5 +1,94 @@
1
- export * from './_group-by-key';
2
- export * from './_lodash';
3
- export * from './_either';
4
- export * from './_path';
5
- export * from './_types';
1
+ interface TakGrouped<T> {
2
+ key: any;
3
+ name: any;
4
+ rows: T[];
5
+ }
6
+ declare function groupByKey<T>(data: Array<T>, columnWithKey: string, columnWithName?: string): TakGrouped<T>[];
7
+
8
+ type List<T> = ArrayLike<T>;
9
+ type Many<T> = T | ReadonlyArray<T>;
10
+ type ListIterator<T, TResult> = (value: T, index: number, collection: List<T>) => TResult;
11
+ type PartialShallow<T> = {
12
+ [P in keyof T]?: T[P] extends object ? object : T[P];
13
+ };
14
+ type PropertyName = string | number | symbol;
15
+ type IterateeShorthand<T> = PropertyName | [PropertyName, any] | PartialShallow<T>;
16
+ type ListIteratee<T> = ListIterator<T, unknown> | IterateeShorthand<T>;
17
+ /**
18
+ * This method is like _.clone except that it recursively clones value.
19
+ *
20
+ * @param value The value to recursively clone.
21
+ * @return Returns the deep cloned value.
22
+ */
23
+ declare function cloneDeep<T>(value: T): T;
24
+ /**
25
+ * Creates a shallow clone of value.
26
+ *
27
+ * @param value The value to clone.
28
+ * @return Returns the cloned value.
29
+ */
30
+ declare function clone<T>(value: T): T | Array<T> | Date;
31
+ /**
32
+ * Creates an array of elements, sorted in ascending / descending order by
33
+ * the results of running each element in a collection through each iteratee.
34
+ * This method performs a stable sort, that is, it preserves the original
35
+ * sort order of equal elements. The iteratees are invoked with one argument:
36
+ * (value).
37
+ *
38
+ * @category Collection
39
+ * @param collection The collection to iterate over.
40
+ * @param [iteratees=[_.identity]] The iteratees to sort by.
41
+ * @param [orders] The sort orders of `iteratees`.
42
+ * @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`.
43
+ * @returns Returns the new sorted array.
44
+ * @example
45
+ *
46
+ * const users = [
47
+ * { 'user': 'fred', 'age': 48 },
48
+ * { 'user': 'barney', 'age': 34 },
49
+ * { 'user': 'fred', 'age': 42 },
50
+ * { 'user': 'barney', 'age': 36 }
51
+ * ];
52
+ *
53
+ * // sort by `user` in ascending order and by `age` in descending order
54
+ * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
55
+ * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
56
+ */
57
+ declare function orderBy<T>(collection: ArrayLike<T> | null | undefined, iteratees?: Many<ListIteratee<T>>, orders?: Many<boolean | 'asc' | 'desc'>): T[];
58
+ /**
59
+ * Return a clone without duplicated values.
60
+ *
61
+ * @param collection
62
+ * @param key
63
+ * @example
64
+ *
65
+ * const data = [1,2,2,3,4,4];
66
+ * const result = uniq(data); // [1,2,3,4]
67
+ *
68
+ * const dataArr = [
69
+ * {nombre : 'Enrique', lastName : 'Cuello'},
70
+ * {nombre : 'Maria', lastName : 'Aponte'},
71
+ * {nombre : 'Enrique', lastName : 'De Armas'},
72
+ * ];
73
+ *
74
+ * const resultArr = uniq(dataArr, 'nombre');
75
+ * // [{nombre : 'Enrique', lastName : 'Cuello'},{nombre : 'Maria', lastName : 'Aponte'}]
76
+ */
77
+ declare function uniq<T>(collection: Array<T>, key?: string): T[];
78
+
79
+ interface EitherResolver<L, R, V> {
80
+ left?: (_: L) => V | undefined;
81
+ right?: (_: R) => V | undefined;
82
+ }
83
+ declare class Either<L, R> {
84
+ private value;
85
+ private constructor();
86
+ fold<V>(resolver: EitherResolver<L, R, V>): V | undefined;
87
+ static left<L>(value: any, isErr?: boolean): Either<L, any>;
88
+ static right<R>(value: R): Either<any, R>;
89
+ }
90
+
91
+ declare const extname: (path: string) => any;
92
+
93
+ export { Either, clone, cloneDeep, extname, groupByKey, orderBy, uniq };
94
+ export type { TakGrouped };