formdata-node
Advanced tools
Comparing version 4.3.0 to 4.3.1
@@ -1,2 +0,2 @@ | ||
import { Blob, BlobPropertyBag } from "./Blob"; | ||
import { Blob, BlobParts as FileBits, BlobPropertyBag } from "./Blob"; | ||
export interface FileLike { | ||
@@ -35,2 +35,5 @@ /** | ||
export declare type FileOptions = FilePropertyBag; | ||
/** | ||
* The **File** interface provides information about files and allows JavaScript to access their content. | ||
*/ | ||
export declare class File extends Blob implements FileLike { | ||
@@ -45,3 +48,3 @@ #private; | ||
*/ | ||
constructor(fileBits: unknown[], name: string, options?: FilePropertyBag); | ||
constructor(fileBits: FileBits, name: string, options?: FilePropertyBag); | ||
get name(): string; | ||
@@ -48,0 +51,0 @@ get lastModified(): number; |
@@ -7,5 +7,2 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
var _FormData_instances, _FormData_entries, _FormData_setEntry; | ||
@@ -19,3 +16,2 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
const deprecateConstructorEntries_1 = require("./deprecateConstructorEntries"); | ||
const normalizeFilename_1 = __importDefault(require("./normalizeFilename")); | ||
class FormData { | ||
@@ -47,7 +43,7 @@ constructor(entries) { | ||
append(name, value, fileName) { | ||
return __classPrivateFieldGet(this, _FormData_instances, "m", _FormData_setEntry).call(this, { | ||
__classPrivateFieldGet(this, _FormData_instances, "m", _FormData_setEntry).call(this, { | ||
name, | ||
value, | ||
fileName, | ||
append: true, | ||
rawValue: value, | ||
argsLength: arguments.length | ||
@@ -57,7 +53,7 @@ }); | ||
set(name, value, fileName) { | ||
return __classPrivateFieldGet(this, _FormData_instances, "m", _FormData_setEntry).call(this, { | ||
__classPrivateFieldGet(this, _FormData_instances, "m", _FormData_setEntry).call(this, { | ||
name, | ||
value, | ||
fileName, | ||
append: false, | ||
rawValue: value, | ||
argsLength: arguments.length | ||
@@ -84,3 +80,3 @@ }); | ||
delete(name) { | ||
return void __classPrivateFieldGet(this, _FormData_entries, "f").delete(String(name)); | ||
__classPrivateFieldGet(this, _FormData_entries, "f").delete(String(name)); | ||
} | ||
@@ -105,5 +101,4 @@ *keys() { | ||
} | ||
[(_FormData_setEntry = function _FormData_setEntry({ name, value, append, fileName, argsLength }) { | ||
[(_FormData_setEntry = function _FormData_setEntry({ name, rawValue, append, fileName, argsLength }) { | ||
const methodName = append ? "append" : "set"; | ||
name = String(name); | ||
if (argsLength < 2) { | ||
@@ -113,8 +108,11 @@ throw new TypeError(`Failed to execute '${methodName}' on 'FormData': ` | ||
} | ||
let normalizedValue; | ||
if ((0, isFile_1.isFile)(value)) { | ||
fileName = (0, normalizeFilename_1.default)(fileName === undefined ? value.name : fileName); | ||
normalizedValue = new File_1.File([value], fileName, { | ||
type: value.type, | ||
lastModified: value.lastModified | ||
name = String(name); | ||
let value; | ||
if ((0, isFile_1.isFile)(rawValue)) { | ||
if (fileName === undefined) { | ||
fileName = rawValue.name === undefined ? "blob" : rawValue.name; | ||
} | ||
value = new File_1.File([rawValue], String(fileName), { | ||
type: rawValue.type, | ||
lastModified: rawValue.lastModified | ||
}); | ||
@@ -127,12 +125,12 @@ } | ||
else { | ||
normalizedValue = String(value); | ||
value = String(rawValue); | ||
} | ||
const values = __classPrivateFieldGet(this, _FormData_entries, "f").get(name); | ||
if (!values) { | ||
return void __classPrivateFieldGet(this, _FormData_entries, "f").set(name, [normalizedValue]); | ||
return void __classPrivateFieldGet(this, _FormData_entries, "f").set(name, [value]); | ||
} | ||
if (!append) { | ||
return void __classPrivateFieldGet(this, _FormData_entries, "f").set(name, [normalizedValue]); | ||
return void __classPrivateFieldGet(this, _FormData_entries, "f").set(name, [value]); | ||
} | ||
values.push(normalizedValue); | ||
values.push(value); | ||
}, Symbol.iterator)]() { | ||
@@ -139,0 +137,0 @@ return this.entries(); |
@@ -12,3 +12,2 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
import { deprecateConstructorEntries } from "./deprecateConstructorEntries.js"; | ||
import normalizeFilename from "./normalizeFilename.js"; | ||
export class FormData { | ||
@@ -40,7 +39,7 @@ constructor(entries) { | ||
append(name, value, fileName) { | ||
return __classPrivateFieldGet(this, _FormData_instances, "m", _FormData_setEntry).call(this, { | ||
__classPrivateFieldGet(this, _FormData_instances, "m", _FormData_setEntry).call(this, { | ||
name, | ||
value, | ||
fileName, | ||
append: true, | ||
rawValue: value, | ||
argsLength: arguments.length | ||
@@ -50,7 +49,7 @@ }); | ||
set(name, value, fileName) { | ||
return __classPrivateFieldGet(this, _FormData_instances, "m", _FormData_setEntry).call(this, { | ||
__classPrivateFieldGet(this, _FormData_instances, "m", _FormData_setEntry).call(this, { | ||
name, | ||
value, | ||
fileName, | ||
append: false, | ||
rawValue: value, | ||
argsLength: arguments.length | ||
@@ -77,3 +76,3 @@ }); | ||
delete(name) { | ||
return void __classPrivateFieldGet(this, _FormData_entries, "f").delete(String(name)); | ||
__classPrivateFieldGet(this, _FormData_entries, "f").delete(String(name)); | ||
} | ||
@@ -98,5 +97,4 @@ *keys() { | ||
} | ||
[(_FormData_setEntry = function _FormData_setEntry({ name, value, append, fileName, argsLength }) { | ||
[(_FormData_setEntry = function _FormData_setEntry({ name, rawValue, append, fileName, argsLength }) { | ||
const methodName = append ? "append" : "set"; | ||
name = String(name); | ||
if (argsLength < 2) { | ||
@@ -106,8 +104,11 @@ throw new TypeError(`Failed to execute '${methodName}' on 'FormData': ` | ||
} | ||
let normalizedValue; | ||
if (isFile(value)) { | ||
fileName = normalizeFilename(fileName === undefined ? value.name : fileName); | ||
normalizedValue = new File([value], fileName, { | ||
type: value.type, | ||
lastModified: value.lastModified | ||
name = String(name); | ||
let value; | ||
if (isFile(rawValue)) { | ||
if (fileName === undefined) { | ||
fileName = rawValue.name === undefined ? "blob" : rawValue.name; | ||
} | ||
value = new File([rawValue], String(fileName), { | ||
type: rawValue.type, | ||
lastModified: rawValue.lastModified | ||
}); | ||
@@ -120,12 +121,12 @@ } | ||
else { | ||
normalizedValue = String(value); | ||
value = String(rawValue); | ||
} | ||
const values = __classPrivateFieldGet(this, _FormData_entries, "f").get(name); | ||
if (!values) { | ||
return void __classPrivateFieldGet(this, _FormData_entries, "f").set(name, [normalizedValue]); | ||
return void __classPrivateFieldGet(this, _FormData_entries, "f").set(name, [value]); | ||
} | ||
if (!append) { | ||
return void __classPrivateFieldGet(this, _FormData_entries, "f").set(name, [normalizedValue]); | ||
return void __classPrivateFieldGet(this, _FormData_entries, "f").set(name, [value]); | ||
} | ||
values.push(normalizedValue); | ||
values.push(value); | ||
}, Symbol.iterator)]() { | ||
@@ -132,0 +133,0 @@ return this.entries(); |
{ | ||
"name": "formdata-node", | ||
"version": "4.3.0", | ||
"version": "4.3.1", | ||
"description": "Spec-compliant FormData implementation for Node.js", | ||
@@ -5,0 +5,0 @@ "repository": "octet-stream/form-data", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85044
42
1321