本文整理汇总了TypeScript中@orbit/utils.eq函数的典型用法代码示例。如果您正苦于以下问题:TypeScript eq函数的具体用法?TypeScript eq怎么用?TypeScript eq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eq函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: deepGet
Object.keys(replacement[grouping]).forEach(field => {
let value = replacement[grouping][field];
let currentValue = deepGet(current, [grouping, field]);
if (!eq(value, currentValue)) {
changed = true;
deepSet(result, [grouping, field], currentValue === undefined ? null : currentValue);
}
});
示例2:
Object.keys(updatedRecord.keys).forEach(key => {
let value = updatedRecord.keys[key];
if (record.keys === undefined || !eq(record.keys[key], value)) {
let op: ReplaceKeyOperation = {
op: 'replaceKey',
record: recordIdentity,
key,
value
};
diffs.push(op);
}
});
示例3:
Object.keys(updatedRecord.attributes).forEach(attribute => {
let value = updatedRecord.attributes[attribute];
if (record.attributes === undefined || !eq(record.attributes[attribute], value)) {
let op: ReplaceAttributeOperation = {
op: 'replaceAttribute',
record: recordIdentity,
attribute,
value
}
diffs.push(op);
}
});
示例4: addRecord
import { SyncRecordAccessor } from '../record-accessor';
export interface SyncInversePatchOperator {
(cache: SyncRecordAccessor, op: RecordOperation): RecordOperation;
}
export const SyncInversePatchOperators: Dict<SyncInversePatchOperator> = {
addRecord(
cache: SyncRecordAccessor,
op: AddRecordOperation
): RecordOperation {
const { type, id } = op.record;
const current = cache.getRecordSync(op.record);
if (current) {
if (eq(current, op.record)) {
return;
} else {
return {
op: 'updateRecord',
record: current
};
}
} else {
return {
op: 'removeRecord',
record: { type, id }
};
}
},