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

@formbricks/react

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formbricks/react - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

dist/chunk-ARXXTIOC.js

6

dist/components/FormbricksSchema.js
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkCBM6EW76js = require('../chunk-CBM6EW76.js');
require('../chunk-MBDQONOF.js');
var _chunkLJOK2OU6js = require('../chunk-LJOK2OU6.js');
require('../chunk-ARXXTIOC.js');
require('../chunk-Z2K5IH6O.js');
exports.FormbricksSchema = _chunkCBM6EW76js.FormbricksSchema;
exports.FormbricksSchema = _chunkLJOK2OU6js.FormbricksSchema;

@@ -6,3 +6,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkMBDQONOFjs = require('../chunk-MBDQONOF.js');
var _chunkARXXTIOCjs = require('../chunk-ARXXTIOC.js');
require('../chunk-Z2K5IH6O.js');

@@ -14,2 +14,2 @@

exports.Button = _chunkMBDQONOFjs.Button; exports.Submit = _chunkMBDQONOFjs.Submit; exports.Text = _chunkMBDQONOFjs.Text; exports.Textarea = _chunkMBDQONOFjs.Textarea;
exports.Button = _chunkARXXTIOCjs.Button; exports.Submit = _chunkARXXTIOCjs.Submit; exports.Text = _chunkARXXTIOCjs.Text; exports.Textarea = _chunkARXXTIOCjs.Textarea;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkCBM6EW76js = require('./chunk-CBM6EW76.js');
var _chunkLJOK2OU6js = require('./chunk-LJOK2OU6.js');

@@ -9,3 +9,3 @@

var _chunkMBDQONOFjs = require('./chunk-MBDQONOF.js');
var _chunkARXXTIOCjs = require('./chunk-ARXXTIOC.js');

@@ -23,2 +23,2 @@

exports.Button = _chunkMBDQONOFjs.Button; exports.Form = _chunkZ2K5IH6Ojs.Form; exports.FormbricksSchema = _chunkCBM6EW76js.FormbricksSchema; exports.SchemaContext = _chunkZ2K5IH6Ojs.SchemaContext; exports.Submit = _chunkMBDQONOFjs.Submit; exports.Text = _chunkMBDQONOFjs.Text; exports.Textarea = _chunkMBDQONOFjs.Textarea;
exports.Button = _chunkARXXTIOCjs.Button; exports.Form = _chunkZ2K5IH6Ojs.Form; exports.FormbricksSchema = _chunkLJOK2OU6js.FormbricksSchema; exports.SchemaContext = _chunkZ2K5IH6Ojs.SchemaContext; exports.Submit = _chunkARXXTIOCjs.Submit; exports.Text = _chunkARXXTIOCjs.Text; exports.Textarea = _chunkARXXTIOCjs.Textarea;
{
"name": "@formbricks/react",
"version": "0.0.8",
"version": "0.0.9",
"author": "Formbricks <hola@formbricks.com>",

@@ -5,0 +5,0 @@ "description": "Building React forms has never been quicker.",

export const getValidationRules = (validation: string | undefined) => {
const validationRules: string[] = [];
const validationRules: any = {};
if (!validation) {

@@ -7,7 +7,35 @@ return validationRules;

for (const validationRule of validation.split("|")) {
if (validationRule === "required" || !validationRules.includes("required")) {
validationRules.push("required");
if (validationRule === "required" && !("required" in validationRules)) {
validationRules.required = {};
}
if (validationRule === "number" && !("number" in validationRules)) {
validationRules.number = {};
}
if (validationRule.startsWith("max:") && !("max" in validationRules)) {
validationRules.max = { value: validationRule.split(":")[1] };
}
if (validationRule.startsWith("min:") && !("min" in validationRules)) {
validationRules.min = { value: validationRule.split(":")[1] };
}
}
return validationRules;
};
export const validate = (validationRules: any) => {
const validation: any = {};
if ("max" in validationRules) {
validation.max = (v: string) =>
parseInt(v) <= validationRules.max.value ||
`Input must be less or equal to ${validationRules.max.value}`;
}
if ("min" in validationRules) {
validation.min = (v: string) =>
parseInt(v) >= validationRules.min.value ||
`Input must be more or equal to ${validationRules.min.value}`;
}
if ("number" in validationRules) {
validation.number = (v: string) =>
("number" in validationRules && /^[+-]?([0-9]*[.])?[0-9]+$/.test(v)) || "Input must be a number";
}
return validation;
};

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

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

Sorry, the diff of this file is not supported yet

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