mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
DISABLE_THIRD_PARTY_CHECK=new npm module causes package-lock change We can get rid of a custom script and use ESLint for these rules. Additionally this means editors will highlight the issue in the editor. Change-Id: I552b52e7f07b4e7430b3f685dbc3b5fad36ffff2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2052167 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
import pipeP from './pipeP.js';
|
|
import reverse from './reverse.js';
|
|
|
|
/**
|
|
* Performs right-to-left composition of one or more Promise-returning
|
|
* functions. The rightmost function may have any arity; the remaining
|
|
* functions must be unary.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.10.0
|
|
* @category Function
|
|
* @sig ((y -> Promise z), (x -> Promise y), ..., (a -> Promise b)) -> (a -> Promise z)
|
|
* @param {...Function} functions The functions to compose
|
|
* @return {Function}
|
|
* @see R.pipeP
|
|
* @deprecated since v0.26.0
|
|
* @example
|
|
*
|
|
* const db = {
|
|
* users: {
|
|
* JOE: {
|
|
* name: 'Joe',
|
|
* followers: ['STEVE', 'SUZY']
|
|
* }
|
|
* }
|
|
* }
|
|
*
|
|
* // We'll pretend to do a db lookup which returns a promise
|
|
* const lookupUser = (userId) => Promise.resolve(db.users[userId])
|
|
* const lookupFollowers = (user) => Promise.resolve(user.followers)
|
|
* lookupUser('JOE').then(lookupFollowers)
|
|
*
|
|
* // followersForUser :: String -> Promise [UserId]
|
|
* const followersForUser = R.composeP(lookupFollowers, lookupUser);
|
|
* followersForUser('JOE').then(followers => console.log('Followers:', followers))
|
|
* // Followers: ["STEVE","SUZY"]
|
|
*/
|
|
export default function composeP() {
|
|
if (arguments.length === 0) {
|
|
throw new Error('composeP requires at least one argument');
|
|
}
|
|
return pipeP.apply(this, reverse(arguments));
|
|
} |