fp-pack 0.5.0 → 0.7.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 (82) hide show
  1. package/README.md +17 -15
  2. package/dist/fp-pack.umd.js +1 -1
  3. package/dist/fp-pack.umd.js.map +1 -1
  4. package/dist/implement/async/pipeAsync.d.ts +11 -0
  5. package/dist/implement/async/pipeAsync.d.ts.map +1 -1
  6. package/dist/implement/async/pipeAsync.mjs.map +1 -1
  7. package/dist/implement/async/pipeAsyncSideEffect.d.ts +11 -0
  8. package/dist/implement/async/pipeAsyncSideEffect.d.ts.map +1 -1
  9. package/dist/implement/async/pipeAsyncSideEffect.mjs.map +1 -1
  10. package/dist/implement/composition/compose.d.ts +25 -9
  11. package/dist/implement/composition/compose.d.ts.map +1 -1
  12. package/dist/implement/composition/compose.mjs.map +1 -1
  13. package/dist/implement/composition/compose.type-test.d.ts +35 -0
  14. package/dist/implement/composition/compose.type-test.d.ts.map +1 -0
  15. package/dist/implement/composition/compose.util.type-test.d.ts +31 -0
  16. package/dist/implement/composition/compose.util.type-test.d.ts.map +1 -0
  17. package/dist/implement/composition/curry.d.ts +5 -5
  18. package/dist/implement/composition/curry.d.ts.map +1 -1
  19. package/dist/implement/composition/curry.mjs.map +1 -1
  20. package/dist/implement/composition/index.d.ts +4 -0
  21. package/dist/implement/composition/index.d.ts.map +1 -1
  22. package/dist/implement/composition/pipe.d.ts +3 -0
  23. package/dist/implement/composition/pipe.d.ts.map +1 -1
  24. package/dist/implement/composition/pipe.mjs.map +1 -1
  25. package/dist/implement/composition/pipe.type-test.d.ts +117 -1
  26. package/dist/implement/composition/pipe.type-test.d.ts.map +1 -1
  27. package/dist/implement/composition/pipe.util.type-test.d.ts +75 -0
  28. package/dist/implement/composition/pipe.util.type-test.d.ts.map +1 -0
  29. package/dist/implement/composition/sideEffect.d.ts +1 -1
  30. package/dist/implement/composition/sideEffect.d.ts.map +1 -1
  31. package/dist/implement/composition/sideEffect.mjs.map +1 -1
  32. package/dist/implement/composition/tap0.d.ts +6 -0
  33. package/dist/implement/composition/tap0.d.ts.map +1 -0
  34. package/dist/implement/composition/tap0.mjs +9 -0
  35. package/dist/implement/composition/tap0.mjs.map +1 -0
  36. package/dist/implement/object/assocPath.d.ts +2 -1
  37. package/dist/implement/object/assocPath.d.ts.map +1 -1
  38. package/dist/implement/object/assocPath.mjs.map +1 -1
  39. package/dist/implement/object/dissocPath.d.ts +2 -1
  40. package/dist/implement/object/dissocPath.d.ts.map +1 -1
  41. package/dist/implement/object/dissocPath.mjs.map +1 -1
  42. package/dist/implement/object/index.d.ts +1 -0
  43. package/dist/implement/object/index.d.ts.map +1 -1
  44. package/dist/implement/object/path.d.ts +4 -2
  45. package/dist/implement/object/path.d.ts.map +1 -1
  46. package/dist/implement/object/path.mjs.map +1 -1
  47. package/dist/implement/object/pathKey.d.ts +2 -0
  48. package/dist/implement/object/pathKey.d.ts.map +1 -0
  49. package/dist/implement/object/pathOr.d.ts +5 -3
  50. package/dist/implement/object/pathOr.d.ts.map +1 -1
  51. package/dist/implement/object/pathOr.mjs.map +1 -1
  52. package/dist/index.d.ts +1 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.mjs +230 -228
  55. package/dist/index.mjs.map +1 -1
  56. package/dist/skills/fp-pack/SKILL.md +19 -16
  57. package/dist/skills/fp-pack.md +19 -16
  58. package/dist/stream/index.d.ts +1 -0
  59. package/dist/stream/index.d.ts.map +1 -1
  60. package/package.json +1 -1
  61. package/src/implement/async/pipeAsync.ts +71 -0
  62. package/src/implement/async/pipeAsyncSideEffect.ts +74 -0
  63. package/src/implement/composition/compose.test.ts +14 -0
  64. package/src/implement/composition/compose.ts +133 -21
  65. package/src/implement/composition/compose.type-test.ts +109 -0
  66. package/src/implement/composition/compose.util.type-test.ts +128 -0
  67. package/src/implement/composition/curry.ts +5 -5
  68. package/src/implement/composition/index.ts +4 -0
  69. package/src/implement/composition/pipe.ts +4 -0
  70. package/src/implement/composition/pipe.type-test.ts +269 -1
  71. package/src/implement/composition/pipe.util.type-test.ts +256 -0
  72. package/src/implement/composition/sideEffect.ts +1 -1
  73. package/src/implement/composition/tap0.test.ts +16 -0
  74. package/src/implement/composition/tap0.ts +10 -0
  75. package/src/implement/object/assocPath.ts +2 -2
  76. package/src/implement/object/dissocPath.ts +2 -2
  77. package/src/implement/object/index.ts +1 -0
  78. package/src/implement/object/path.ts +5 -3
  79. package/src/implement/object/pathKey.ts +1 -0
  80. package/src/implement/object/pathOr.ts +6 -4
  81. package/src/index.ts +3 -0
  82. package/src/stream/index.ts +1 -0
@@ -1,6 +1,5 @@
1
1
  import curry from '../composition/curry';
2
-
3
- type PathKey = string | number | symbol;
2
+ import type { PathKey } from './pathKey';
4
3
 
5
4
  const isIndexKey = (key: PathKey): key is number | `${number}` => {
6
5
  if (typeof key === 'number') {
@@ -62,3 +61,4 @@ function assocPath<T = unknown>(pathArray: PathKey[], value: unknown, obj: unkno
62
61
 
63
62
  const curriedAssocPath = curry(assocPath) as AssocPath;
64
63
  export default curriedAssocPath;
64
+ export type { PathKey };
@@ -1,6 +1,5 @@
1
1
  import curry from '../composition/curry';
2
-
3
- type PathKey = string | number | symbol;
2
+ import type { PathKey } from './pathKey';
4
3
 
5
4
  const isIndexKey = (key: PathKey): key is number | `${number}` => {
6
5
  if (typeof key === 'number') {
@@ -78,3 +77,4 @@ function dissocPath<T = unknown>(pathArray: PathKey[], obj: T): T {
78
77
 
79
78
  const curriedDissocPath = curry(dissocPath) as DissocPath;
80
79
  export default curriedDissocPath;
80
+ export type { PathKey };
@@ -19,3 +19,4 @@ export { default as mapValues } from './mapValues';
19
19
  export { default as evolve } from './evolve';
20
20
  export { default as has } from './has';
21
21
  export { default as hasPath } from './hasPath';
22
+ export type { PathKey } from './pathKey';
@@ -1,16 +1,18 @@
1
1
  import curry from '../composition/curry';
2
+ import type { PathKey } from './pathKey';
2
3
 
3
4
  type Path = {
4
- (pathArray: string[]): <T>(obj: any) => T | undefined;
5
- <T>(...args: [pathArray: string[], obj: any]): T | undefined;
5
+ (pathArray: PathKey[]): <T>(obj: any) => T | undefined;
6
+ <T>(...args: [pathArray: PathKey[], obj: any]): T | undefined;
6
7
  };
7
8
 
8
9
  /**
9
10
  * path - 안전한 깊은 프로퍼티 접근
10
11
  */
11
- function path<T>(pathArray: string[], obj: any): T | undefined {
12
+ function path<T>(pathArray: PathKey[], obj: any): T | undefined {
12
13
  return pathArray.reduce((current, key) => (current == null ? undefined : current[key]), obj) as T | undefined;
13
14
  }
14
15
 
15
16
  const curriedPath = curry(path) as Path;
16
17
  export default curriedPath;
18
+ export type { PathKey };
@@ -0,0 +1 @@
1
+ export type PathKey = string | number | symbol;
@@ -1,18 +1,20 @@
1
1
  import curry from '../composition/curry';
2
+ import type { PathKey } from './pathKey';
2
3
 
3
4
  type PathOr = {
4
- <D>(...args: [defaultValue: D]): <T>(pathArray: string[]) => (obj: any) => T | D;
5
- <D>(...args: [defaultValue: D, pathArray: string[]]): <T>(obj: any) => T | D;
6
- <T, D>(...args: [defaultValue: D, pathArray: string[], obj: any]): T | D;
5
+ <D>(...args: [defaultValue: D]): <T>(pathArray: PathKey[]) => (obj: any) => T | D;
6
+ <D>(...args: [defaultValue: D, pathArray: PathKey[]]): <T>(obj: any) => T | D;
7
+ <T, D>(...args: [defaultValue: D, pathArray: PathKey[], obj: any]): T | D;
7
8
  };
8
9
 
9
10
  /**
10
11
  * pathOr - 기본값이 있는 깊은 프로퍼티 접근
11
12
  */
12
- function pathOr<T, D>(defaultValue: D, pathArray: string[], obj: any): T | D {
13
+ function pathOr<T, D>(defaultValue: D, pathArray: PathKey[], obj: any): T | D {
13
14
  const value = pathArray.reduce((current, key) => (current == null ? undefined : current[key]), obj) as T | undefined;
14
15
  return value == null ? defaultValue : value;
15
16
  }
16
17
 
17
18
  const curriedPathOr = curry(pathOr) as PathOr;
18
19
  export default curriedPathOr;
20
+ export type { PathKey };
package/src/index.ts CHANGED
@@ -30,3 +30,6 @@ export * from './implement/nullable';
30
30
 
31
31
  // Debug
32
32
  export * from './implement/debug';
33
+
34
+ // Stream Types
35
+ export type { AnyIterable, AnyIterableInput, PromiseLikeValue } from './stream/utils';
@@ -21,3 +21,4 @@ export { default as toArray } from './toArray';
21
21
  export { default as toAsync } from './toAsync';
22
22
  export { default as zip } from './zip';
23
23
  export { default as zipWith } from './zipWith';
24
+ export type { AnyIterable, AnyIterableInput, PromiseLikeValue } from './utils';