本文整理汇总了TypeScript中lodash.toPlainObject函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toPlainObject函数的具体用法?TypeScript toPlainObject怎么用?TypeScript toPlainObject使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toPlainObject函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const removePrototype = (srcVal: any, objVal: any) => {
if (ng1.isObject(objVal) && !ng1.isArray(objVal)) {
return _.toPlainObject(objVal);
} else {
return objVal;
}
};
示例2: test
test('with NUMERIC internal id', function () {
const c = new cust.CustomerBase(123)
expect(c).toBeTruthy()
// should call load once
expect(mockrecord.load.mock.calls.length).toBe(1)
console.log(_.toPlainObject(c))
})
示例3: UserRegistration
.then(() => {
const fixture = TestBed.createComponent(TestComponent);
fixture.detectChanges();
const component: UserRegistrationComponent =
fixture.debugElement.children[0].componentInstance as UserRegistrationComponent;
const dom: HTMLElement = fixture.debugElement.children[0].nativeElement as HTMLElement;
const formData: UserRegistration = new UserRegistration(
'Lazar',
'Bodor',
'Geoscience Australia',
'Software developer',
'lazar.bodor@ga.gov.au',
'0451061798',
'ADE1',
);
const setValue = (value: string, controlName: string): void => {
let input: HTMLInputElement =
dom.querySelector('text-input[controlname=' + controlName + '] input') as HTMLInputElement;
if (!input) {
input = dom.querySelector('email-input[controlname='
+ controlName + '] input') as HTMLInputElement;
}
if (!input) {
input = dom.querySelector('textarea-input[controlname='
+ controlName + '] textarea') as HTMLInputElement;
}
expect(input).toBeTruthy();
input.value = value;
input.dispatchEvent(new Event('input'));
};
_.forOwn(formData, setValue);
fixture.detectChanges();
component.submit();
expect(_.isEqual(_.toPlainObject(mockUserService.registration), _.toPlainObject(formData))).toBeTruthy();
});
示例4: handler
return handler(arg).catch(e => {
throw _.toPlainObject(e);
});