@oscarpalmer/atoms 0.141.2 → 0.143.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 (61) hide show
  1. package/dist/atoms.full.js +185 -72
  2. package/dist/color/misc/is.js +6 -6
  3. package/dist/function/memoize.js +1 -1
  4. package/dist/index.js +7 -6
  5. package/dist/internal/math/aggregate.js +12 -8
  6. package/dist/internal/number.js +1 -1
  7. package/dist/internal/value/partial.js +14 -0
  8. package/dist/is.js +11 -3
  9. package/dist/math.js +21 -5
  10. package/dist/promise.js +107 -36
  11. package/dist/result.js +7 -5
  12. package/dist/sized/map.js +1 -1
  13. package/dist/sized/set.js +2 -2
  14. package/dist/value/misc.js +3 -2
  15. package/dist/value/omit.js +11 -0
  16. package/dist/value/pick.js +11 -0
  17. package/package.json +5 -5
  18. package/src/color/misc/is.ts +6 -6
  19. package/src/function/debounce.ts +2 -2
  20. package/src/function/memoize.ts +1 -1
  21. package/src/function/throttle.ts +2 -2
  22. package/src/index.ts +2 -1
  23. package/src/internal/function/limiter.ts +3 -3
  24. package/src/internal/math/aggregate.ts +19 -10
  25. package/src/internal/number.ts +1 -1
  26. package/src/internal/value/partial.ts +46 -0
  27. package/src/is.ts +11 -2
  28. package/src/math.ts +67 -9
  29. package/src/models.ts +2 -2
  30. package/src/promise.ts +249 -57
  31. package/src/random.ts +2 -2
  32. package/src/result.ts +31 -11
  33. package/src/sized/map.ts +1 -1
  34. package/src/sized/set.ts +2 -2
  35. package/src/value/get-set.ts +1 -1
  36. package/src/value/merge.ts +1 -1
  37. package/src/value/misc.ts +2 -1
  38. package/src/value/omit.ts +19 -0
  39. package/src/value/pick.ts +19 -0
  40. package/types/color/misc/is.d.ts +6 -6
  41. package/types/function/debounce.d.ts +2 -2
  42. package/types/function/memoize.d.ts +1 -1
  43. package/types/function/throttle.d.ts +2 -2
  44. package/types/index.d.ts +2 -1
  45. package/types/internal/function/limiter.d.ts +2 -2
  46. package/types/internal/math/aggregate.d.ts +1 -0
  47. package/types/internal/number.d.ts +1 -1
  48. package/types/internal/value/partial.d.ts +2 -0
  49. package/types/is.d.ts +8 -2
  50. package/types/math.d.ts +20 -0
  51. package/types/models.d.ts +2 -2
  52. package/types/promise.d.ts +68 -11
  53. package/types/random.d.ts +2 -2
  54. package/types/result.d.ts +21 -6
  55. package/types/sized/map.d.ts +1 -1
  56. package/types/sized/set.d.ts +2 -2
  57. package/types/value/misc.d.ts +2 -1
  58. package/types/value/omit.d.ts +8 -0
  59. package/types/value/{partial.d.ts → pick.d.ts} +1 -1
  60. package/dist/value/partial.js +0 -17
  61. package/src/value/partial.ts +0 -39
@@ -1,39 +0,0 @@
1
- import type {PlainObject} from '../models';
2
-
3
- // #region Functions
4
-
5
- /**
6
- * Create a new object with only the specified keys
7
- * @param value Original object
8
- * @param keys Keys to use
9
- * @returns Partial object with only the specified keys
10
- */
11
- export function partial<Value extends PlainObject, Key extends keyof Value>(
12
- value: Value,
13
- keys: Key[],
14
- ): Pick<Value, Key> {
15
- if (
16
- typeof value !== 'object' ||
17
- value === null ||
18
- Object.keys(value).length === 0 ||
19
- !Array.isArray(keys) ||
20
- keys.length === 0
21
- ) {
22
- return {} as Pick<Value, Key>;
23
- }
24
-
25
- const {length} = keys;
26
- const partials = {} as Pick<Value, Key>;
27
-
28
- for (let index = 0; index < length; index += 1) {
29
- const key = keys[index];
30
-
31
- if (key in value) {
32
- partials[key] = value[key];
33
- }
34
- }
35
-
36
- return partials;
37
- }
38
-
39
- // #endregion