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

TypeScript ramda.isEmpty函数代码示例

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

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



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

示例1: wrapForeignOpt

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

  // prettier-ignore
  const associationFields = R.filter(R.compose(R.not, R.isNil, R.prop('associations')))(fields);
  logger.log(TAG, { associationFields }, R.not(R.isEmpty(associationFields)));
  if (R.not(R.isEmpty(associationFields))) {
    const wrapForeignOpt = R.map(opt => ({
      ...opt,
      association: AppContext.adapters.models.getAssociationConfigs(opt.modelName),
    }));
    const withAssociations = R.mapObjIndexed(field => ({
      ...field,
      foreignOpts: wrapForeignOpt(field.foreignOpts),
    }))(associationFields);
    logger.debug(TAG, { withAssociations, wrapForeignOpt });

    const wrappedFields = R.mergeDeepRight(fields, withAssociations);
    logger.debug(TAG, { wrappedFields });

    return { modelName, fields: wrappedFields };
  }

  return { modelName, fields };
};
开发者ID:danielwii,项目名称:asuna-admin,代码行数:26,代码来源:index.ts


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


示例3: mapProps

  /**
   * Return a object mapped with the source properties based on the rules
   * @param rules The rules for mapping the properties
   * @param source The source object to map from
   * @param result The resulting object to map to
   */
  static mapProps(rules, source, result) {
    if (!R.isEmpty(rules) && !R.isEmpty(source)) {
      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);

      return result;
    }

    return result;
  }
开发者ID:simbiosis-group,项目名称:ion2-helper,代码行数:22,代码来源:record-helper.ts


示例4: dispatch

 .then(response => {
   if (response.errors && !isEmpty(response.errors)) {
     dispatch(handleEnableError(response));
   }
   else {
     dispatch(handleEnableSuccess(response.success));
   }
   dispatch(updateMultipleLinodes(response.success));
 })
开发者ID:displague,项目名称:manager,代码行数:9,代码来源:index.ts


示例5:

		const create = (name) => {
			if (!R.isEmpty(name)) {
				this.store.dispatch(this.customerAction.createSuccess(name))
				receipt.customer = name;
				return true;
			}

			return false;
		}
开发者ID:simbiosis-group,项目名称:ion2-claim,代码行数:9,代码来源:receipt-form.ts


示例6: next

  return next => action => {
    if (!isPromise(action.payload)) {
      return next(action);
    }

    const { types, payload, meta } = action;
    const { promise, data } = payload;
    const [ PENDING, FULFILLED, REJECTED ] = types;

   /**
    * Dispatch the pending action
    */
    let pendingAction = {type: PENDING, payload: null, meta: null};
    if (R.isEmpty(data)) {
      pendingAction.payload = data;
    }
    if (R.isEmpty(meta)) {
      pendingAction.meta = meta;
    }
    dispatch(pendingAction);


    /**
     * If successful, dispatch the fulfilled action, otherwise dispatch
     * rejected action.
     */
    return promise.then(
      result => {
        dispatch({
          type: FULFILLED,
          payload: result,
          meta,
        });
      },
      error => {
        dispatch({
          type: REJECTED,
          payload: error,
          meta,
        });
      }
    );
  };
开发者ID:Alber70g,项目名称:angular-redux-starter,代码行数:43,代码来源:promise-middleware.ts


示例7: Error

 .then(([travels, reservations]: [Travel[], Reservation[]]) => {
     if (R.isArrayLike(travels) && R.isArrayLike(reservations) && !R.isEmpty(travels)) {
         const travel = R.head(travels);
         if ((reservation.travelType === "OUT" && canOut(reservations)) || (reservation.travelType === "IN" && canIn(reservations, travel.placeLimit))) {
             return Promise.resolve(this.respository.save(reservation));
         }
         return Promise.reject(getError(new Error("Place limit")));
     }
     return Promise.reject(getError(new Error("Travel not exist")));
 }, rejected => {
开发者ID:dominikus1993,项目名称:TravelAssistantNode,代码行数:10,代码来源:service.ts


示例8: getNextNumber

  /**
   * Return the next running number in an array of records
   * @param {string} prop The property name
   * @param data The array of records containing the property
   */
  static getNextNumber(prop: string, data: Array<any>) {
    if (R.isEmpty(data)) { return 1 }
    const getNextNumber = R.pipe(
      R.sortBy(R.prop(prop)),
      R.pluck(prop),
      R.last()
    );

    return parseInt(getNextNumber(data)) + 1;
  }
开发者ID:simbiosis-group,项目名称:ion2-helper,代码行数:15,代码来源:array-helper.ts


示例9: countBusySlots

export function countBusySlots(reservations: Reservation[]): number {
    if (!R.isEmpty(reservations)) {
        const [_in, out] =  reservations.map(x => x.travelType).reduce(([_in, out], x) => {
            if (x === "IN") {
                return [_in + 1, out]
            }
            return [_in, out + 1];
        }, [0, 0]);

        return _in - out;
    }
    return 0;
}
开发者ID:dominikus1993,项目名称:TravelAssistantNode,代码行数:13,代码来源:service.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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