Skip to content

Commit 4fdfa54

Browse files
committed
fix example
1 parent 2042ad3 commit 4fdfa54

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

all.js

+7-24
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,15 @@ const _allValues = function (values) {
113113
* getAndLogUserById('1') // Got user {"_id":1,"name":"George"} by id 1
114114
* ```
115115
*
116-
* Values passed in resolver position are set on the result object or array directly. If any of these values are promises, they are resolved for their values before being set on the result object or array.
116+
* Values may be provided along with functions, in which case they are set on the result object or array directly. If any of these values are promises, they are resolved for their values before being set on the result object or array.
117117
*
118118
* ```javascript [playground]
119-
* all({}, [
120-
* Promise.resolve(1),
121-
* ])
119+
* all({}, {
120+
* a: Promise.resolve(1),
121+
* b: 2,
122+
* c: () => 3,
123+
* d: async () => 4,
124+
* }).then(console.log) // { a: 1, b: 2, c: 3, d: 4 }
122125
* ```
123126
*
124127
* Any promises passed in argument position are resolved for their values before further execution. This only applies to the eager version of the API.
@@ -161,26 +164,6 @@ const all = function (...args) {
161164
return isArray(resolversOrValues)
162165
? functionArrayAll(resolversOrValues, argValues)
163166
: functionObjectAll(resolversOrValues, argValues)
164-
165-
/*
166-
////////////////////////////////////////////////////////////////
167-
const funcs = args.pop()
168-
if (args.length == 0) {
169-
return isArray(funcs)
170-
? curryArgs2(functionArrayAll, funcs, __)
171-
: curryArgs2(functionObjectAll, funcs, __)
172-
}
173-
174-
if (areAnyValuesPromises(args)) {
175-
return isArray(funcs)
176-
? promiseAll(args).then(curry2(functionArrayAll, funcs, __))
177-
: promiseAll(args).then(curry2(functionObjectAll, funcs, __))
178-
}
179-
180-
return isArray(funcs)
181-
? functionArrayAll(funcs, args)
182-
: functionObjectAll(funcs, args)
183-
*/
184167
}
185168

186169
/**

0 commit comments

Comments
 (0)