当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript utils.merge函数代码示例

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


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

示例1: merge

 ['attributes', 'keys', 'relationships'].forEach(grouping => {
   if (current[grouping] && updates[grouping]) {
     record[grouping] = merge({}, current[grouping], updates[grouping]);
   } else if (current[grouping]) {
     record[grouping] = merge({}, current[grouping]);
   } else if (updates[grouping]) {
     record[grouping] = merge({}, updates[grouping]);
   }
 });
开发者ID:SmuliS,项目名称:orbit.js,代码行数:9,代码来源:record.ts

示例2: mergeRequestOptions

export function mergeRequestOptions(
  options: RequestOptions,
  customOptions: RequestOptions
) {
  let result: RequestOptions = {};
  merge(result, options, customOptions);
  if (options.include && customOptions.include) {
    result.include = mergeIncludePaths(options.include, customOptions.include);
  }
  if (options.filter && customOptions.filter) {
    result.filter = mergeFilters(options.filter, customOptions.filter);
  }
  return result;
}
开发者ID:orbitjs,项目名称:orbit.js,代码行数:14,代码来源:request-settings.ts

示例3: buildFilterParam

    let requestOptions: RequestOptions = {};

    if (expression.filter) {
      requestOptions.filter = buildFilterParam(source, expression.filter);
    }

    if (expression.sort) {
      requestOptions.sort = buildSortParam(source, expression.sort);
    }

    if (expression.page) {
      requestOptions.page = expression.page;
    }

    requestOptions = merge(
      requestOptions,
      customRequestOptions(source, query));

    const settings = buildFetchSettings(requestOptions);

    return source.fetch(source.resourceURL(type), settings)
      .then(data => deserialize(source, data));
  },

  findRelatedRecord(source: JSONAPISource, query: Query) {
    const expression = query.expression as FindRelatedRecord;
    const { record, relationship } = expression;

    const requestOptions = customRequestOptions(source, query);
    const settings = buildFetchSettings(requestOptions);
开发者ID:SmuliS,项目名称:orbit.js,代码行数:30,代码来源:pull-operators.ts


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