Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/sale/checkout-form/src/form/ |
Upload File : |
export default class Model { fields: Map<string, mixed> = null; originalFields: Map<string, mixed> = null; constructor(fields: Object<string, mixed>) { this.initFields(fields); } initFields(fields: Object<string, mixed>): void { this.fields = new Map(Object.entries(fields)); this.originalFields = new Map(Object.entries(fields)); } hasField(name: string): boolean { return this.fields.has(name); } getFields(): Object { const fields = {}; for (let [k, v] of this.fields) { fields[k] = v; } return fields; } getField(name: string, defaultValue: ?mixed = null): mixed { return this.fields.has(name) ? this.fields.get(name) : defaultValue; } getOriginalField(name: string): ?mixed { return this.originalFields.has(name) ? this.originalFields.get(name) : null; } setField(name: string, value: mixed): boolean { this.fields.set(name, value); return this.getOriginalField(name) === value; } }