New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@felte/react

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@felte/react - npm Package Compare versions

Comparing version 1.0.0-next.10 to 1.0.0-next.11

dist/esm/index.js

256

dist/index.js

@@ -17,13 +17,42 @@ 'use strict';

/** @ignore */
function _some(obj, pred) {
const keys = Object.keys(obj);
return keys.some((key) => pred(obj[key]));
/**
* @category Helper
*/
function isInputElement(el) {
var _a;
return ((_a = el) === null || _a === void 0 ? void 0 : _a.nodeName) === 'INPUT';
}
/** @ignore */
function _mapValues(obj, updater) {
const keys = Object.keys(obj);
return keys.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: updater(obj[key]) })), {});
/**
* @category Helper
*/
function isTextAreaElement(el) {
var _a;
return ((_a = el) === null || _a === void 0 ? void 0 : _a.nodeName) === 'TEXTAREA';
}
/**
* @category Helper
*/
function isSelectElement(el) {
var _a;
return ((_a = el) === null || _a === void 0 ? void 0 : _a.nodeName) === 'SELECT';
}
/**
* @category Helper
*/
function isFieldSetElement(el) {
var _a;
return ((_a = el) === null || _a === void 0 ? void 0 : _a.nodeName) === 'FIELDSET';
}
/**
* @category Helper
*/
function isFormControl(el) {
return isInputElement(el) || isTextAreaElement(el) || isSelectElement(el);
}
/**
* @category Helper
*/
function isElement(el) {
return el.nodeType === Node.ELEMENT_NODE;
}

@@ -44,2 +73,8 @@ /** @ignore */

/** @ignore */
function _mapValues(obj, updater) {
const keys = Object.keys(obj);
return keys.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: updater(obj[key]) })), {});
}
function handleArray(value) {

@@ -101,24 +136,2 @@ return function (propVal) {

function defaultsCustomizer(objValue, srcValue) {
if (_isPlainObject(objValue) && _isPlainObject(srcValue))
return;
if (Array.isArray(srcValue)) {
if (srcValue.some(_isPlainObject))
return;
const objArray = Array.isArray(objValue) ? objValue : [];
return srcValue.map((value, index) => { var _a; return (_a = objArray[index]) !== null && _a !== void 0 ? _a : value; });
}
if (typeof objValue !== 'undefined')
return objValue;
}
/** @ignore */
function _defaultsDeep(...args) {
return _mergeWith(...args, defaultsCustomizer);
}
/** @ignore */
function _merge(...args) {
return _mergeWith(...args, () => undefined);
}
/* From: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_get */

@@ -160,22 +173,2 @@ /** @ignore */

function _unset(obj, path) {
if (!obj || Object(obj) !== obj)
return;
// When obj is not an object
else if (typeof obj !== 'undefined')
obj = _cloneDeep(obj);
// If not yet an array, get the keys from the string-path
const newPath = !Array.isArray(path)
? path.toString().match(/[^.[\]]+/g) || []
: path;
const foundProp = newPath.length === 1 ? obj : _get(obj, newPath.slice(0, -1).join('.'));
if (Array.isArray(foundProp)) {
foundProp.splice(Number(newPath[newPath.length - 1]), 1);
}
else {
foundProp === null || foundProp === void 0 ? true : delete foundProp[newPath[newPath.length - 1]];
}
return obj;
}
/** @ignore */

@@ -204,9 +197,2 @@ function _update(obj, path, updater) {

/**
* @category Helper
*/
function deepSome(obj, pred) {
return _some(obj, (value) => _isPlainObject(value) ? deepSome(value, pred) : pred(value));
}
/**
* @ignore

@@ -223,43 +209,2 @@ */

*/
function isInputElement(el) {
var _a;
return ((_a = el) === null || _a === void 0 ? void 0 : _a.nodeName) === 'INPUT';
}
/**
* @category Helper
*/
function isTextAreaElement(el) {
var _a;
return ((_a = el) === null || _a === void 0 ? void 0 : _a.nodeName) === 'TEXTAREA';
}
/**
* @category Helper
*/
function isSelectElement(el) {
var _a;
return ((_a = el) === null || _a === void 0 ? void 0 : _a.nodeName) === 'SELECT';
}
/**
* @category Helper
*/
function isFieldSetElement(el) {
var _a;
return ((_a = el) === null || _a === void 0 ? void 0 : _a.nodeName) === 'FIELDSET';
}
/**
* @category Helper
*/
function isFormControl(el) {
return isInputElement(el) || isTextAreaElement(el) || isSelectElement(el);
}
/**
* @category Helper
*/
function isElement(el) {
return el.nodeType === Node.ELEMENT_NODE;
}
/**
* @category Helper
*/
function getPath(el, name) {

@@ -289,32 +234,3 @@ const index = getIndex(el);

function getPathFromDataset(el) {
const fieldSetName = el.dataset.felteFieldset;
const index = getIndex(el);
const fieldName = typeof index === 'undefined' ? el.name : `${el.name}[${index}]`;
return fieldSetName ? `${fieldSetName}.${fieldName}` : fieldName;
}
/**
* @category Helper
*/
function shouldIgnore(el) {
let parent = el;
while (parent && parent.nodeName !== 'FORM') {
if (parent.hasAttribute('data-felte-ignore'))
return true;
parent = parent.parentElement;
}
return false;
}
function getValue(storeValue, selectorOrPath) {
if (!_isPlainObject(storeValue) || !selectorOrPath)
return storeValue;
if (typeof selectorOrPath === 'string') {
return _get(storeValue, selectorOrPath);
}
return selectorOrPath(storeValue);
}
/**
* @ignore

@@ -510,2 +426,77 @@ */

/** @ignore */
function _merge(...args) {
return _mergeWith(...args, () => undefined);
}
/** @ignore */
function _some(obj, pred) {
const keys = Object.keys(obj);
return keys.some((key) => pred(obj[key]));
}
/**
* @category Helper
*/
function deepSome(obj, pred) {
return _some(obj, (value) => _isPlainObject(value) ? deepSome(value, pred) : pred(value));
}
/**
* @category Helper
*/
function shouldIgnore(el) {
let parent = el;
while (parent && parent.nodeName !== 'FORM') {
if (parent.hasAttribute('data-felte-ignore'))
return true;
parent = parent.parentElement;
}
return false;
}
function defaultsCustomizer(objValue, srcValue) {
if (_isPlainObject(objValue) && _isPlainObject(srcValue))
return;
if (Array.isArray(srcValue)) {
if (srcValue.some(_isPlainObject))
return;
const objArray = Array.isArray(objValue) ? objValue : [];
return srcValue.map((value, index) => { var _a; return (_a = objArray[index]) !== null && _a !== void 0 ? _a : value; });
}
if (typeof objValue !== 'undefined')
return objValue;
}
/** @ignore */
function _defaultsDeep(...args) {
return _mergeWith(...args, defaultsCustomizer);
}
function _unset(obj, path) {
if (!obj || Object(obj) !== obj)
return;
// When obj is not an object
else if (typeof obj !== 'undefined')
obj = _cloneDeep(obj);
// If not yet an array, get the keys from the string-path
const newPath = !Array.isArray(path)
? path.toString().match(/[^.[\]]+/g) || []
: path;
const foundProp = newPath.length === 1 ? obj : _get(obj, newPath.slice(0, -1).join('.'));
if (Array.isArray(foundProp)) {
foundProp.splice(Number(newPath[newPath.length - 1]), 1);
}
else {
foundProp === null || foundProp === void 0 ? true : delete foundProp[newPath[newPath.length - 1]];
}
return obj;
}
function getPathFromDataset(el) {
const fieldSetName = el.dataset.felteFieldset;
const index = getIndex(el);
const fieldName = typeof index === 'undefined' ? el.name : `${el.name}[${index}]`;
return fieldSetName ? `${fieldSetName}.${fieldName}` : fieldName;
}
class FelteSubmitError extends Error {

@@ -1231,2 +1222,11 @@ constructor(message, response) {

function getValue(storeValue, selectorOrPath) {
if (!_isPlainObject(storeValue) || !selectorOrPath)
return storeValue;
if (typeof selectorOrPath === 'string') {
return _get(storeValue, selectorOrPath);
}
return selectorOrPath(storeValue);
}
function isWritable(store) {

@@ -1233,0 +1233,0 @@ return !!store.set;

{
"name": "@felte/react",
"version": "1.0.0-next.10",
"version": "1.0.0-next.11",
"description": "An extensible form library for ReactJS",
"main": "dist/index.js",
"browser": "dist/index.js",
"module": "dist/index.mjs",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",

@@ -29,3 +29,3 @@ "type": "module",

"dependencies": {
"@felte/core": "1.0.0-next.7"
"@felte/core": "1.0.0-next.8"
},

@@ -39,3 +39,3 @@ "publishConfig": {

"devDependencies": {
"@felte/common": "1.0.0-next.6",
"@felte/common": "1.0.0-next.7",
"@testing-library/jest-dom": "^5.11.9",

@@ -51,5 +51,5 @@ "@testing-library/react": "^12.1.2",

".": {
"import": "./dist/index.mjs",
"import": "./dist/esm/index.js",
"require": "./dist/index.js",
"default": "./dist/index.mjs"
"default": "./dist/esm/index.js"
},

@@ -60,3 +60,3 @@ "./package.json": "./package.json"

"prebuild": "rimraf ./dist",
"build": "cross-env NODE_ENV=production rollup -c",
"build": "pnpm prebuild && cross-env NODE_ENV=production rollup -c",
"dev": "rollup -cw",

@@ -63,0 +63,0 @@ "test": "jest",

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