flamerest 1.0.44 → 1.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/REST.js +23 -18
  2. package/package.json +1 -1
package/REST.js CHANGED
@@ -484,31 +484,36 @@ class FLAMEREST {
484
484
  for (let val in values) {
485
485
 
486
486
  // Преобразуем
487
- if (typeof values[val] === 'object'
488
- && values[val].hasOwnProperty('value')
487
+ let value = values[val];
488
+ let isRef = false;
489
+ if (value instanceof Object
490
+ && value.hasOwnProperty('_value')
489
491
  && (
490
- values[val].value instanceof Event ||
491
- values[val].value instanceof HTMLInputElement ||
492
- values[val].value instanceof ClipboardEvent ||
493
- values[val].value instanceof DataTransfer ||
494
- values[val].value instanceof FileList
492
+ value._value instanceof Event ||
493
+ value._value instanceof HTMLInputElement ||
494
+ value._value instanceof ClipboardEvent ||
495
+ value._value instanceof DataTransfer ||
496
+ value._value instanceof FileList
495
497
  )
496
- ) values[val] = values[val].value;
498
+ ) {value = value.value; isRef = true}
497
499
 
498
- if (values[val] instanceof Event && values[val].target instanceof HTMLInputElement && values[val].target.type === 'file') values[val] = values[val].target.files;
499
- if (values[val] instanceof HTMLInputElement && values[val].type === 'file') values[val] = values[val].files;
500
- if (values[val] instanceof ClipboardEvent) values[val] = values[val].clipboardData.files;
501
- if (values[val] instanceof DataTransfer) values[val] = values[val].files;
502
- if (values[val] instanceof FileList) {
500
+ if (value instanceof Event && value.target instanceof HTMLInputElement && value.target.type === 'file') value = value.target.files;
501
+ if (value instanceof HTMLInputElement && value.type === 'file') value = value.files;
502
+ if (value instanceof ClipboardEvent) value = value.clipboardData.files;
503
+ if (value instanceof DataTransfer) value = value.files;
504
+ if (value instanceof FileList) {
503
505
  let newValues = [];
504
- values[val] = Array.from(values[val]);
505
- for (let file in values[val]) {
506
+ value = Array.from(value);
507
+ for (let file in value) {
506
508
  newValues.push({
507
- 'name': values[val][file].name,
508
- 'data': await this.readFileAsync(values[val][file])
509
+ 'name': value[file].name,
510
+ 'data': await this.readFileAsync(value[file])
509
511
  });
510
512
  }
511
- values[val] = newValues;
513
+ if (isRef)
514
+ values[val].value = newValues;
515
+ else
516
+ values[val] = newValues;
512
517
  }
513
518
  }
514
519
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flamerest",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "description": "",
5
5
  "main": "REST.js",
6
6
  "typings": "./REST.d.ts",