本文整理汇总了TypeScript中lodash.omitBy函数的典型用法代码示例。如果您正苦于以下问题:TypeScript omitBy函数的具体用法?TypeScript omitBy怎么用?TypeScript omitBy使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了omitBy函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: restoreModified
[`${resource}Modified`]: async function restoreModified(message: any,
ctx: any, config: any, eventName: string): Promise<any> {
that.decodeBufferField(message, resource);
await db.update(`${resource}s`, { id: message.id }, _.omitBy(message, _.isNil));
return {};
},
示例2: payments
export function payments(state: PaymentsState = initialState, {type, payload}: Action): PaymentsState {
switch (type) {
case PatientActions.REMOVE_SUCCESS: {
const data = _.omitBy(state.data, p => p.patient_id == payload) as PaymentData;
const ids = _.values(data).map(data => data['id']);
return { ...state, ids, data };
}
case PaymentsActions.EDIT_SUCCESS: {
return { ...state, data: { ...state.data, [payload.id]: payload } };
}
case PaymentsActions.CREATE_SUCCESS: {
const data = { ...state.data, [payload.id]: payload };
const ids = [payload.id, ...state.ids];
return { selected: payload.id, status: true, ids , data };
}
case PaymentsActions.REMOVE_SUCCESS: {
const ids = state.ids.filter(ids => ids !== payload.id);
const data = _.omit(state.data, payload.id) as PaymentData;
return { ...state, ids, data };
}
case PaymentsActions.INIT_SUCCESS: {
const ids = payload.map(data => data.id);
const data = _.mapKeys(payload, 'id') as PaymentData;
return { ...state, status: false, ids, data };
}
default: return state;
}
};
示例3: findExamClashes
export function findExamClashes(modules: Module[], semester: Semester): ExamClashes {
const groupedModules = groupBy(modules, (module) =>
get(getModuleSemesterData(module, semester), 'examDate'),
);
delete groupedModules.undefined; // Remove modules without exams
return omitBy(groupedModules, (mods) => mods.length === 1); // Remove non-clashing mods
}
示例4: buildSaveObject
buildSaveObject() {
const obj = _.omitBy(this, (val, key) => {
return _.startsWith(key, '$')
|| _.isNotWritable(this, key);
});
return obj;
}
示例5: onSubmit
onSubmit(params) {
this.passwordConfirmation.updateValueAndValidity({});
this.passwordConfirmation.markAsTouched();
if (!this.myForm.valid) return;
this.userService.updateMe(omitBy(params, isEmpty))
.subscribe(() => {
toastr.success('Successfully updated.');
}, this.handleError);
}
示例6: getSpecialStatString
static getSpecialStatString(item) {
const newItem = _.omitBy(item, (val, key) => {
return _.includes(baseIgnores, key) || _.includes(key, 'Percent') || _.includes(key, 'item') || !_.isNumber(val) || key === 'vector' || _.includes(key, 'Req');
});
return _(newItem)
.keys()
.filter(key => newItem[key] !== 0)
.map(key => `${key}(${newItem[key]})`)
.join(' ');
}
示例7: updateCommunity
updateCommunity(community: noosfero.Community) {
const headers = {
'Content-Type': 'application/json'
};
const attributesToUpdate: any = {
community: Object.assign({}, _.omitBy(_.pick(community, ['name', 'closed']), _.isNull))
};
const restRequest = this.getElement(community.id).customOperation("patch", null, null, headers, attributesToUpdate);
return restRequest.toPromise().then(this.getHandleSuccessFunction());
}
示例8: getFilterUrl
export function getFilterUrl(ownProps: OwnProps, part: RawQuery) {
const basePathName = ownProps.organization
? `/organizations/${ownProps.organization.key}/projects`
: '/projects';
const pathname = basePathName + (ownProps.isFavorite ? '/favorite' : '');
const query: RawQuery = omitBy({ ...ownProps.query, ...part }, isNil);
each(query, (value, key) => {
if (Array.isArray(value)) {
query[key] = value.join(',');
}
});
return { pathname, query };
}
示例9: getStandaloneMainSections
export function getStandaloneMainSections(sysInfoData: T.SysInfoBase): T.SysInfoValueObject {
return {
...getSystemData(sysInfoData),
...(omitBy(
sysInfoData,
(value, key) =>
value == null ||
[PLUGINS_FIELD, SETTINGS_FIELD, STATS_FIELD, SYSTEM_FIELD].includes(key) ||
key.startsWith(CE_FIELD_PREFIX) ||
key.startsWith(SEARCH_PREFIX) ||
key.startsWith(WEB_PREFIX)
) as T.SysInfoValueObject)
};
}
示例10: getStandaloneMainSections
export function getStandaloneMainSections(sysInfoData: SysInfo): SysValueObject {
return {
...getSystemData(sysInfoData),
...(omitBy(
sysInfoData,
(value, key) =>
value == null ||
[PLUGINS_FIELD, SETTINGS_FIELD, 'Statistics', 'System'].includes(key) ||
key.startsWith('Compute Engine') ||
key.startsWith('Search') ||
key.startsWith('Web')
) as SysValueObject)
};
}