Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object-to-formdata

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-to-formdata - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

2

package.json
{
"name": "object-to-formdata",
"version": "4.2.0",
"version": "4.2.1",
"keywords": [

@@ -5,0 +5,0 @@ "form",

@@ -1,48 +0,57 @@

const isUndefined = (value) => value === undefined;
function isUndefined(value) {
return value === undefined;
}
const isNull = (value) => value === null;
function isNull(value) {
return value === null;
}
const isBoolean = (value) => typeof value === 'boolean';
function isBoolean(value) {
return typeof value === 'boolean';
}
const isObject = (value) => value === Object(value);
function isObject(value) {
return value === Object(value);
}
const isArray = (value) => Array.isArray(value);
function isArray(value) {
return Array.isArray(value);
}
const isDate = (value) => value instanceof Date;
function isDate(value) {
return value instanceof Date;
}
const isBlob = (value) =>
value &&
typeof value.size === 'number' &&
typeof value.type === 'string' &&
typeof value.slice === 'function';
function isBlob(value) {
return (
value &&
typeof value.size === 'number' &&
typeof value.type === 'string' &&
typeof value.slice === 'function'
);
}
const isFile = (value) =>
isBlob(value) &&
typeof value.name === 'string' &&
(typeof value.lastModifiedDate === 'object' ||
typeof value.lastModified === 'number');
function isFile(value) {
return (
isBlob(value) &&
typeof value.name === 'string' &&
(typeof value.lastModifiedDate === 'object' ||
typeof value.lastModified === 'number')
);
}
const serialize = (obj, cfg, fd, pre) => {
function initCfgValue(value) {
return isUndefined(value) ? false : value;
}
function serialize(obj, cfg, fd, pre) {
cfg = cfg || {};
fd = fd || new FormData();
cfg.indices = isUndefined(cfg.indices) ? false : cfg.indices;
Object.keys(cfg).forEach((opt) => {
const value = cfg[opt];
cfg.nullsAsUndefineds = isUndefined(cfg.nullsAsUndefineds)
? false
: cfg.nullsAsUndefineds;
cfg[opt] = isUndefined(value) ? false : value;
});
cfg.booleansAsIntegers = isUndefined(cfg.booleansAsIntegers)
? false
: cfg.booleansAsIntegers;
cfg.allowEmptyArrays = isUndefined(cfg.allowEmptyArrays)
? false
: cfg.allowEmptyArrays;
cfg.noFilesWithArrayNotation = isUndefined(cfg.noFilesWithArrayNotation)
? false
: cfg.noFilesWithArrayNotation;
fd = fd || new FormData();
if (isUndefined(obj)) {

@@ -95,3 +104,3 @@ return fd;

return fd;
};
}

@@ -98,0 +107,0 @@ module.exports = {

@@ -9,3 +9,3 @@ export type Options = {

export const serialize: <T = {}>(
export function serialize<T = {}>(
object: T,

@@ -15,2 +15,2 @@ options?: Options,

keyPrefix?: string,
) => FormData;
): FormData;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc