• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ramda.merge函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中ramda.merge函数的典型用法代码示例。如果您正苦于以下问题:TypeScript merge函数的具体用法?TypeScript merge怎么用?TypeScript merge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了merge函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: checkOneBrowser

function checkOneBrowser(browser: Browser) {
  const platform = os.platform()
  const pickBrowserProps = pick([
    'name',
    'displayName',
    'type',
    'version',
    'path'
  ])

  const logBrowser = (props: any) => {
    log('setting major version for %j', props)
  }

  const failed = (err: NotInstalledError) => {
    if (err.notInstalled) {
      log('browser %s not installed', browser.name)
      return false
    }
    throw err
  }

  log('checking one browser %s', browser.name)
  return lookup(platform, browser)
    .then(merge(browser))
    .then(pickBrowserProps)
    .then(tap(logBrowser))
    .then(setMajorVersion)
    .catch(failed)
}
开发者ID:lgandecki,项目名称:cypress,代码行数:30,代码来源:detect.ts


示例2: merge

 const set = data => {
   for (let x = 0; x < data.width; x++) {
     for (let y = 0; y < data.height; y++) {
       // cant read from MST array above bounds, so check length first
       // @ts-ignore
       self.field[x] = x === self.field.length ? [] : self.field[x]
       self.field[x][y] = y === self.field[x].length ? {} : self.field[x][y]
       // merge to preserve flags on UI
       self.field[x][y] = merge(self.field[x][y], data.field[x][y])
     }
   }
   Object.assign(
     self,
     pick(
       [
         'width',
         'height',
         'bombCount',
         'cellsLeft',
         'isFinished',
         'isWon',
         'isLost'
       ],
       data
     )
   )
 }
开发者ID:NotBadDevs,项目名称:minesweepers,代码行数:27,代码来源:game.ts


示例3: writeFileStreamCB

        function writeFileStreamCB(e, file) {
            if (e) return observer.error(e);

            observer.next(merge(
                getFilenameMetaData(path || ''),
                {file}
            ));
            observer.complete();
        }
开发者ID:r-k-b,项目名称:newsblur-feed-info,代码行数:9,代码来源:index.ts


示例4: merge

const frameReducer = (state: FrameState, action: FrameAction): FrameState => {
  if (action.type === "cycle") {
    if (state.view === "score") {
      return merge(state, {
        view: "pins",
        squareNumber: 1,
      })
    } else {
      const nextSquare = state.squareNumber + 1
      if (nextSquare > state.frame.squares.length) {
        return merge(state, { view: "score" })
      }
      return merge(state, {
        view: "pins",
        squareNumber: nextSquare,
      })
    }
  }
  return state
}
开发者ID:nordfjord,项目名称:eyc-live,代码行数:20,代码来源:Frame.ts


示例5:

      this[actionType] = (_payload) => {

        // Check to see if the payload is an object or not
        let payload = R.is(Object, _payload) ? _payload : {};
        // Attach action type to the payload
        payload = R.merge(_payload, { actionType: actionType });
        this.dispatcher.dispatch(payload);
        // return payload for testing
        return payload;

      };
开发者ID:webintensive,项目名称:angular-2-transition-utils,代码行数:11,代码来源:actions.ts


示例6: reduceHealth

const damageMinionHandler = (
  state: Minion,
  payload: DealDamagePayload
): Minion => {
  const health = reduceHealth(state, payload.amount);

  return R.merge(state, {
    destroyed: health <= 0,
    health: health,
  });
};
开发者ID:zernie,项目名称:typescript-redux-card-game,代码行数:11,代码来源:minionReducer.ts


示例7: reduceHealth

const damageHeroHandler = (state: Hero, payload: DealDamagePayload): Hero => {
  const health = reduceHealth(state, payload.amount);
  const destroyed = health <= 0;

  return R.merge(state, {
    armor: reduceArmor(state, payload.amount),
    destroyed,
    playState: destroyed ? PlayState.Lost : state.playState,
    health: health,
  });
};
开发者ID:zernie,项目名称:typescript-redux-card-game,代码行数:11,代码来源:heroReducer.ts


示例8: switch

const panesReducer = (previousState = initialState, action) => {
  if (isPanesModule(action)) {
    switch (action.type) {
      case panesActionTypes.OPEN: {
        const {
          payload: { pane },
        } = action;
        return { activeKey: pane.key, panes: { ...previousState.panes, [pane.key]: pane } };
      }
      case panesActionTypes.ACTIVE: {
        const {
          payload: { key },
        } = action;
        return { ...previousState, activeKey: key };
      }
      case panesActionTypes.CLOSE: {
        const { activeKey, panes } = previousState;
        const {
          payload: { key },
        } = action;

        // prettier-ignore
        const index = R.compose(R.indexOf(activeKey), R.keys)(panes);
        const nextPanes = _.omit(panes, key);

        const nextKeys = _.keys(nextPanes);
        const nextKey =
          activeKey && _.has(nextPanes, activeKey)
            ? activeKey
            : // 关闭当前 tab 时定位到后面一个 tab
              nextKeys[_.min([index, nextKeys.length - 1]) as number];
        return { activeKey: nextKey, panes: nextPanes };
      }
      case panesActionTypes.CLOSE_ALL: {
        return {};
      }
      case panesActionTypes.CLOSE_WITHOUT: {
        const {
          payload: { activeKey },
        } = action;
        if (activeKey) {
          const panes = R.pick([activeKey])(previousState.panes);
          return R.merge(previousState, { panes });
        }
        return {};
      }
      default:
        return { ...previousState, ...action.payload };
    }
  }
  return previousState;
};
开发者ID:danielwii,项目名称:asuna-admin,代码行数:52,代码来源:panes.redux.ts


示例9: detect

export function detect(browser: Browser): Promise<FoundBrowser> {
  let fn = browsers[browser.name]

  if (!fn) {
    // ok, maybe it is custom alias?
    log('detecting custom browser %s on darwin', browser.name)
    return linuxHelper.detect(browser)
  }

  return fn()
    .then(merge({ name: browser.name }))
    .catch(() => {
      log('could not detect %s using traditional Mac methods', browser.name)
      log('trying linux search')
      return linuxHelper.detect(browser)
    })
}
开发者ID:YOU54F,项目名称:cypress,代码行数:17,代码来源:index.ts


示例10: constructors

function constructors(state = [], action): Array<Constructor> {
    // CREATE A NEW TEST CONTROLER

    let newConstructorcopy = Array.from(state);

    switch (action.type) {
        case constants.CREATE_NEW_CONSTRUCTOR:

            newConstructorcopy.push(R.merge(action.elements, {

                browsers: R.clone(getState("browsersSelect"))

            }));

            return newConstructorcopy;
        default:
            return state;
    }
}
开发者ID:thehachez,项目名称:maduk,代码行数:19,代码来源:index.ts



注:本文中的ramda.merge函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript ramda.mergeDeepRight函数代码示例发布时间:2022-05-25
下一篇:
TypeScript ramda.mapObjIndexed函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap