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

TypeScript ramda.isNil函数代码示例

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

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



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


示例16:

		.combineLatest(employees$.filter(res => !R.isNil(res)))
开发者ID:simbiosis-group,项目名称:ion2-claim,代码行数:1,代码来源:user.model.ts


示例17:

 const concat = R.reduce((a, b) => {
   if (R.isEmpty(b) || R.isNil(b)) { return a }
   return a + '\n' + b
 }, '');
开发者ID:simbiosis-group,项目名称:ion2-helper,代码行数:4,代码来源:formatter.ts


示例18:

    ].reduce((acc, validator: swaggerTypeConfig) => {
        if (R.isNil(validator)) return acc;

        const [name, value] = validator;
        return value === true ? acc[name]() : acc[name](value);
    }, joi);
开发者ID:benjambles,项目名称:my-own-world,代码行数:6,代码来源:build-joi-spec.ts


示例19: isEmpty

 (v: any) => isEmpty(v) || isNil(v)
开发者ID:linode,项目名称:manager,代码行数:1,代码来源:index.ts


示例20:

		.combineLatest(receipts$.filter(res => !R.isNil(res)))
开发者ID:simbiosis-group,项目名称:ion2-claim,代码行数:1,代码来源:claim.model.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript ramda.join函数代码示例发布时间:2022-05-25
下一篇:
TypeScript ramda.isEmpty函数代码示例发布时间: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