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


TypeScript ramda.isNil函數代碼示例

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


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

示例1:

export const getStatus = (application) => {
	if (R.isNil(application.firstReviewer) || R.isNil(application.secondReviewer)) {
		return application.status
	}

	if (application.firstReviewerStatus === STATUS_APPROVED && application.secondReviewerStatus === STATUS_APPROVED) {
		return STATUS_APPROVED;
	}

	return STATUS_REJECTED;
}
開發者ID:simbiosis-group,項目名稱:ion2-member,代碼行數:11,代碼來源:application.model.ts

示例2: filter

 return configs.map((config: NodeBalancerConfigFields) => {
   return filter(
     /* remove the (key: value) pairs that we set to undefined */
     el => el !== undefined,
     {
       check_path: config.check_path || undefined,
       protocol:
         /*
          * If the provided protocol is "https" and the cert and key are set
          * to "<REDACTED", don't try to set the protocol, it has already
          * been set to "https".
          */
         config.protocol === 'https' &&
         config.ssl_cert === '<REDACTED>' &&
         config.ssl_key === '<REDACTED>'
           ? undefined
           : config.protocol || undefined,
       algorithm: config.algorithm || undefined,
       stickiness: config.stickiness || undefined,
       check: config.check || undefined,
       check_interval: !isNil(config.check_interval)
         ? +config.check_interval
         : undefined,
       check_timeout: !isNil(config.check_timeout)
         ? +config.check_timeout
         : undefined,
       check_attempts: !isNil(config.check_attempts)
         ? +config.check_attempts
         : undefined,
       port: config.port ? +config.port : undefined,
       check_body: config.check_body || undefined,
       check_passive: config.check_passive /* will be boolean or undefined */,
       cipher_suite: config.cipher_suite || undefined,
       ssl_cert:
         config.ssl_cert === '<REDACTED>'
           ? undefined
           : config.ssl_cert || undefined,
       ssl_key:
         config.ssl_key === '<REDACTED>'
           ? undefined
           : config.ssl_key || undefined,
       nodes: config.nodes.map(nodeForRequest),
       id: undefined,
       nodebalancer_id: undefined,
       nodes_status: undefined,
       ssl_fingerprint: undefined,
       ssl_commonname: undefined
     }
   ) as any;
 }) as NodeBalancerConfigFields[];
開發者ID:linode,項目名稱:manager,代碼行數:50,代碼來源:utils.ts

示例3: castModelKey

export const hiddenComponentDecorator = ({
  modelName,
  fields,
}: {
  modelName: string;
  fields: Fields;
}): { modelName; fields: Fields & WithHidden } => {
  const TAG = '[hiddenComponentDecorator]';
  logger.log(TAG, { fields });

  let wrappedFields = R.omit([castModelKey('createdAt'), castModelKey('updatedAt')])(fields);
  if (R.has('id', wrappedFields)) {
    const hidden = R.isNil(wrappedFields.id.value);
    wrappedFields = R.mergeDeepRight(wrappedFields, { id: { options: { hidden } } });
  }

  const positions = R.filter(R.pathEq(['options', 'type'], 'SortPosition'))(wrappedFields);
  if (!R.isEmpty(positions)) {
    const hiddenPositions = R.map(position => ({
      ...position,
      options: { hidden: true },
    }))(positions);

    wrappedFields = R.mergeDeepRight(wrappedFields, { ...hiddenPositions });
  }
  logger.log(TAG, 'wrappedFields', { wrappedFields }, diff(fields, wrappedFields));
  return { modelName, fields: wrappedFields };
};
開發者ID:danielwii,項目名稱:asuna-admin,代碼行數:28,代碼來源:index.ts

示例4: Error

export const result = (error: string, data: any): never | any => {
    if (isNil(data)) {
        throw new Error(error);
    }

    return data;
};
開發者ID:benjambles,項目名稱:my-own-world,代碼行數:7,代碼來源:index.ts

示例5: function

    return function(...args: any[]) {
        for (let fun of funcs) {
            let ret = fun(...args);
            if (!isNil(ret)) return ret;
        }

        return undefined;
    };
開發者ID:s-m-i-t-a,項目名稱:railroadjs,代碼行數:8,代碼來源:dispatch.ts

示例6: modelReducer

  function modelReducer(acc, key) {

    if (!R.isNil(model.tableAttributes[key].references)) {
      acc.push(model.tableAttributes[key].references.model);
      // references.model here is the name of the table
    }

    return acc;
  }
開發者ID:repositive,項目名稱:hapi-path-generator,代碼行數:9,代碼來源:modelRelations.ts

示例7: objOf

const createTypeRecord = (value?: string): null | DiskRecord | VolumeRecord => {
  if (isNil(value) || value === 'none') {
    return null;
  }

  // Given: volume-123
  const [type, id] = split('-', value); // -> [volume, 123]

  const key = `${type}_id`; // -> `volume_id`
  const idAsNumber = Number(id); // -> 123

  return objOf(key, idAsNumber); // -> { volume_id: 123 }
};
開發者ID:linode,項目名稱:manager,代碼行數:13,代碼來源:createDevicesFromStrings.ts

示例8: 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

示例9:

 fields.forEach(field => {
   if (!toFilter) {
     if (R.is(Object, field)) {
       const key = R.head(R.keys(field));
       const value = R.values(field);
       if (key === 'eq') {
         toFilter = (obj[value] === query);
       }
     } else {
       if (!R.isNil(obj[field])) {
         toFilter = obj[field].toString()
           .toLowerCase().indexOf(query) > -1
       }
     }
   }
 });
開發者ID:simbiosis-group,項目名稱:ion2-helper,代碼行數:16,代碼來源:array-helper.ts

示例10: getBasePathFilter

const findRouteConfig = (config: any, pathParts: string[]) => {
    const getBasePath = getBasePathFilter(pathParts);

    if (
        !pathParts.length ||
        R.isNil(config.paths) ||
        (pathParts.length === 1 && getBasePath(config))
    ) {
        return config;
    }

    const newConfig = getBasePath(config.paths);
    const newPathParts = [pathParts.slice(0, 2).join('/')].concat(pathParts.slice(2));

    return findRouteConfig(newConfig, newPathParts);
};
開發者ID:benjambles,項目名稱:my-own-world,代碼行數:16,代碼來源:index.ts

示例11:

			.filter(res => !R.isNil(res))
開發者ID:simbiosis-group,項目名稱:ion2-claim,代碼行數:1,代碼來源:receipt-form.ts

示例12: isNil

export const isNilOrEmpty = (v: any) => isNil(v) || isEmpty(v);
開發者ID:displague,項目名稱:manager,代碼行數:1,代碼來源:utils.ts

示例13: compose

const isNotEmpty = compose(not, (v: any) => isEmpty(v) || isNil(v));
開發者ID:displague,項目名稱:manager,代碼行數:1,代碼來源:index.ts

示例14:

const isCreateSocketValid = (createSocket: (path: string) => WebSocket) => !isNil(createSocket)
開發者ID:nick121212,項目名稱:reactotron,代碼行數:1,代碼來源:validate.ts

示例15:

 Object.keys(raw).filter((key) => {
   return !R.isNil(model.options.scopes[key]);
 })
開發者ID:repositive,項目名稱:hapi-path-generator,代碼行數:3,代碼來源:httpQueryParser.ts


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