-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:selfrefactor/rambda into 8.4.0
- Loading branch information
Showing
11 changed files
with
222 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
import { type } from './type.js' | ||
import { pipeAsync } from './pipeAsync.js' | ||
|
||
export function composeAsync(...inputArguments){ | ||
return async function (startArgument){ | ||
let argumentsToPass = startArgument | ||
|
||
while (inputArguments.length !== 0){ | ||
const fn = inputArguments.pop() | ||
|
||
argumentsToPass = fn(argumentsToPass) | ||
if (type(argumentsToPass) === 'Promise'){ | ||
argumentsToPass = await argumentsToPass | ||
} | ||
} | ||
|
||
return argumentsToPass | ||
} | ||
} | ||
export function composeAsync(...fnList){ | ||
return pipeAsync(...fnList.reverse()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,7 @@ | ||
import { type } from './type.js' | ||
import { reduce } from "./reduce"; | ||
|
||
export function pipeAsync(...inputArguments){ | ||
return async function (startArgument){ | ||
let argumentsToPass = startArgument | ||
|
||
while (inputArguments.length !== 0){ | ||
const fn = inputArguments.shift() | ||
|
||
argumentsToPass = fn(argumentsToPass) | ||
if (type(argumentsToPass) === 'Promise'){ | ||
argumentsToPass = await argumentsToPass | ||
} | ||
} | ||
|
||
return argumentsToPass | ||
export function pipeAsync(...fnList){ | ||
return function (startArgument){ | ||
return reduce(async (value, fn) => fn(await value), startArgument, fnList) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.