🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

zod-form-data

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zod-form-data - npm Package Compare versions

Comparing version

to
2.0.5

35

dist/index.js

@@ -49,3 +49,34 @@ "use strict";

});
var import_set_get = require("@rvf/set-get");
// ../set-get/dist/index.esm.js
var stringToPathArray = (path) => {
if (path.length === 0)
return [];
const match = path.match(/^\[(.+?)\](.*)$/) || path.match(/^\.?([^\.\[\]]+)(.*)$/);
if (match) {
const [_, key, rest] = match;
return [/^\d+$/.test(key) ? Number(key) : key, ...stringToPathArray(rest)];
}
return [path];
};
function setPath(object, path, value) {
const parts = Array.isArray(path) ? path : stringToPathArray(path);
let obj = object;
for (let i = 0; i < parts.length - 1; i++) {
const part = parts[i];
const nextPart = parts[i + 1];
if (obj[part] === void 0) {
if (typeof nextPart === "number") {
obj[part] = [];
} else {
obj[part] = {};
}
}
obj = obj[part];
}
obj[parts[parts.length - 1]] = value;
return object;
}
// src/helpers.ts
var import_zod = require("zod");

@@ -116,3 +147,3 @@ var stripEmpty = import_zod.z.literal("").transform(() => void 0);

(acc, [key, value]) => {
return (0, import_set_get.setPath)(acc, key, value.length === 1 ? value[0] : value);
return setPath(acc, key, value.length === 1 ? value[0] : value);
},

@@ -119,0 +150,0 @@ {}

5

package.json
{
"name": "zod-form-data",
"version": "2.0.4",
"version": "2.0.5",
"homepage": "https://github.com/airjp73/rvf/tree/main/packages/zod-form-data",

@@ -28,4 +28,3 @@ "main": "./dist/index.js",

"peerDependencies": {
"zod": ">= 3.11.0",
"@rvf/set-get": ">= 6.0.3 < 8.0.0"
"zod": ">= 3.11.0"
},

@@ -32,0 +31,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet