本文整理汇总了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]);
}
});
示例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;
}
示例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);