當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ramda.is函數代碼示例

本文整理匯總了TypeScript中ramda.is函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript is函數的具體用法?TypeScript is怎麽用?TypeScript is使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了is函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: catch

 const toJson = value => {
   if (R.is(String, value) && value.length) {
     try {
       return JSON.parse(value);
     } catch (e) {
       logger.warn(TAG, e, { jsonFields });
       return null;
     }
   }
   if (R.is(Object, value)) {
     return value;
   }
   return null;
 };
開發者ID:danielwii,項目名稱:asuna-admin,代碼行數:14,代碼來源:index.ts

示例2: map

 map((key: string) => {
   const keyMinusWildcard = slice(0, -2, key)
   const value = dotPath(keyMinusWildcard, state)
   if (is(Object, value) && !isNilOrEmpty(value)) {
     return pipe(keys, map(key => `${keyMinusWildcard}.${key}`))(value)
   }
   return []
 }) as any,
開發者ID:nick121212,項目名稱:reactotron,代碼行數:8,代碼來源:reactotron-mst.ts

示例3:

 const assignFields = R.forEach(n => {
   if (R.is(Object, n)) {
     const key = R.pipe(R.keys, R.head)(n);
     const value = R.pipe(R.values, R.head)(n);
     return result[key] = source[value];
   }
   return result[n] = source[n];
 })(rules);
開發者ID:simbiosis-group,項目名稱:ion2-helper,代碼行數:8,代碼來源:record-helper.ts

示例4:

 R.map(field => {
   // raw is the original value, if exists, means it's update request
   if (field.value && !field.raw) {
     const value = R.is(String, field.value) ? JSON.parse(field.value) : field.value;
     return { ...field, value, raw: field.value };
   }
   return { ...field, value: R.path([current, 'value'])(fields), raw: field.value };
 }),
開發者ID:danielwii,項目名稱:asuna-admin,代碼行數:8,代碼來源:index.ts

示例5: dispatch

  /**
   * Dispatches a payload to all registered callbacks
   * @param {object} payload Must contain an actionType property
   */
  public dispatch(payload) {

    if (R.is(Object, payload) && R.prop('actionType')) {
      this._dispatcherObsv.onNext(payload);
    } else {
      throw new Error('payload must be an object with at least an actionType property');
    }

  }
開發者ID:webintensive,項目名稱:angular-2-transition-utils,代碼行數:13,代碼來源:dispatcher.ts

示例6: curryN

export let forwardMessage = curryN(2, (options = {}, update: Update) => Request({
  type: 'sink',
  method: 'forwardMessage',
  options: defaults(
    {
      from_chat_id: defaultTo(path(['message', 'chat', 'id'], update)),
      message_id: defaultTo(path(['message', 'message_id'], update))
    },
    is(Number, options) ? {chat_id: options} : options)
}))
開發者ID:goodmind,項目名稱:cycle-telegram,代碼行數:10,代碼來源:sinks.ts

示例7: is

 apiResponse: (request, response, duration) => {
   const ok =
     response &&
     response.status &&
     is(Number, response.status) &&
     response.status >= 200 &&
     response.status <= 299
   const important = !ok
   reactotron.send("api.response", { request, response, duration }, important)
 },
開發者ID:nick121212,項目名稱:reactotron,代碼行數:10,代碼來源:api-response.ts

示例8:

      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

示例9: path

  const linearMatch = target => {
    const value = path(modifierPath, target)

    if (is(Boolean, value)) {
      return value
    }

    if (isNil(value)) {
      return false
    }

    return !isEmpty(value)
  }
開發者ID:monstrs,項目名稱:elementum,代碼行數:13,代碼來源:match.ts


注:本文中的ramda.is函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。