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

@felte/common

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@felte/common - npm Package Compare versions

Comparing version 0.4.6 to 0.4.7

dist/esm/utils/getPathFromDataset.js

6

CHANGELOG.md
# @felte/common
## 0.4.7
### Patch Changes
- 8049209: Fix Felte not removing the field from the data store when the input has a fieldset and the fieldset is not removed alongside the input.
## 0.4.6

@@ -4,0 +10,0 @@

2

dist/esm/index.js

@@ -1,2 +0,2 @@

export{_some}from"./utils/some.js";export{_mapValues}from"./utils/mapValues.js";export{isFieldValue}from"./utils/isFieldValue.js";export{_cloneDeep}from"./utils/cloneDeep.js";export{_isPlainObject}from"./utils/isPlainObject.js";export{_mergeWith}from"./utils/mergeWith.js";export{_defaultsDeep}from"./utils/defaultsDeep.js";export{_merge}from"./utils/merge.js";export{_get}from"./utils/get.js";export{_set}from"./utils/set.js";export{_unset}from"./utils/unset.js";export{_update}from"./utils/update.js";export{deepSet}from"./utils/deepSet.js";export{deepSome}from"./utils/deepSome.js";export{getIndex}from"./utils/getIndex.js";export{isElement,isFieldSetElement,isFormControl,isInputElement,isSelectElement,isTextAreaElement}from"./utils/typeGuards.js";export{getPath}from"./utils/getPath.js";export{addAttrsFromFieldset,executeValidation,getFormControls,getFormDefaultValues,getInputTextOrNumber,setControlValue,setForm}from"./utils/domUtils.js";
export{_some}from"./utils/some.js";export{_mapValues}from"./utils/mapValues.js";export{isFieldValue}from"./utils/isFieldValue.js";export{_cloneDeep}from"./utils/cloneDeep.js";export{_isPlainObject}from"./utils/isPlainObject.js";export{_mergeWith}from"./utils/mergeWith.js";export{_defaultsDeep}from"./utils/defaultsDeep.js";export{_merge}from"./utils/merge.js";export{_get}from"./utils/get.js";export{_set}from"./utils/set.js";export{_unset}from"./utils/unset.js";export{_update}from"./utils/update.js";export{deepSet}from"./utils/deepSet.js";export{deepSome}from"./utils/deepSome.js";export{getIndex}from"./utils/getIndex.js";export{isElement,isFieldSetElement,isFormControl,isInputElement,isSelectElement,isTextAreaElement}from"./utils/typeGuards.js";export{getPath}from"./utils/getPath.js";export{getPathFromDataset}from"./utils/getPathFromDataset.js";export{addAttrsFromFieldset,executeValidation,getFormControls,getFormDefaultValues,getInputTextOrNumber,setControlValue,setForm}from"./utils/domUtils.js";
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{isFormControl as e,isFieldSetElement as t}from"./typeGuards.js";function n(e){return e.hasAttribute("data-felte-index")?Number(e.dataset.felteIndex):void 0}function r(r,o){const a=n(r);let d="";o?d=o:e(r)&&(d=r.name),d=void 0===a?d:`${d}[${a}]`;let i=r.parentNode;if(!i)return d;for(;i&&"FORM"!==i.nodeName;){if(t(i)&&i.name){const e=n(i);d=`${void 0===e?i.name:`${i.name}[${e}]`}.${d}`}i=i.parentNode}return d}export{r as getPath};
import{isFormControl as e,isFieldSetElement as n}from"./typeGuards.js";import{getIndex as o}from"./getIndex.js";function t(t,r){const m=o(t);let a="";r?a=r:e(t)&&(a=t.name),a=void 0===m?a:`${a}[${m}]`;let d=t.parentNode;if(!d)return a;for(;d&&"FORM"!==d.nodeName;){if(n(d)&&d.name){const e=o(d);a=`${void 0===e?d.name:`${d.name}[${e}]`}.${a}`}d=d.parentNode}return a}export{t as getPath};
//# sourceMappingURL=getPath.js.map

@@ -18,4 +18,5 @@ export { _some } from "./utils/some";

export { getPath } from "./utils/getPath";
export { getPathFromDataset } from "./utils/getPathFromDataset";
export * from "./utils/domUtils";
export * from "./types-50c3e825";
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Common={})}(this,(function(e){"use strict";function t(e,t){return Object.keys(e).some((n=>t(e[n])))}function n(e,t){return Object.keys(e).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:t(e[r])})),{})}function r(e){return"[object Object]"===Object.prototype.toString.call(e)}function i(e){return Object.keys(e||{}).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:r(e[n])?i(e[n]):Array.isArray(e[n])?[...e[n]]:e[n]})),{})}function o(e,t){return n(e,(e=>r(e)?o(e,t):Array.isArray(e)?e.map(function(e){return function(t){return r(t)?o(t,e):e}}(t)):t))}function u(...e){const t=e.pop(),n=i(e.shift());if(0===e.length)return n;for(const a of e){if(!a)continue;const e=Object.keys(a);for(const c of e){const e=t(n[c],a[c]);if(void 0!==e)n[c]=e;else if(r(a[c])&&r(n[c]))n[c]=u(n[c],a[c],t);else if(Array.isArray(a[c])&&Array.isArray(n[c]))n[c]=a[c].map(((e,r)=>u(n[c][r],e,t)));else if(r(a[c])){const e=o(i(a[c]),void 0);n[c]=u(e,a[c],t)}else void 0!==a[c]&&(n[c]=a[c])}}return n}function a(e,t){if(!r(e)||!r(t)){if(Array.isArray(t)){if(t.some(r))return;const n=Array.isArray(e)?e:[];return t.map(((e,t)=>{var r;return null!==(r=n[t])&&void 0!==r?r:e}))}return void 0!==e?e:void 0}}function c(e,t,n){const r=n=>String.prototype.split.call(t,n).filter(Boolean).reduce(((e,t)=>null!=e?e[t]:e),e),i=r(/[,[\]]+?/)||r(/[,[\].]+?/);return void 0===i||i===e?n:i}function f(e,t,n){Object(e)!==e?e={}:void 0!==e&&(e=i(e));let r=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g)||[];return r.slice(0,-1).reduce(((e,t,n)=>Object(e[t])===e[t]?e[t]:e[t]=Math.abs(Number(r[n+1]))>>0==+r[n+1]?[]:{}),e)[r[r.length-1]]=n,e}function l(e,t,n){Object(e)!==e&&(e={});let r=t.toString().match(/[^.[\]]+/g)||[];return r.slice(0,-1).reduce(((e,t,n)=>Object(e[t])===e[t]?e[t]:e[t]=Math.abs(Number(r[n+1]))>>0==+r[n+1]?[]:{}),e)[r[r.length-1]]=n(c(e,t)),e}function s(e){return e.hasAttribute("data-felte-index")?Number(e.dataset.felteIndex):void 0}function d(e){var t;return"INPUT"===(null===(t=e)||void 0===t?void 0:t.nodeName)}function m(e){var t;return"TEXTAREA"===(null===(t=e)||void 0===t?void 0:t.nodeName)}function y(e){var t;return"SELECT"===(null===(t=e)||void 0===t?void 0:t.nodeName)}function v(e){var t;return"FIELDSET"===(null===(t=e)||void 0===t?void 0:t.nodeName)}function p(e){return d(e)||m(e)||y(e)}function A(e){return e.hasAttribute("data-felte-index")?Number(e.dataset.felteIndex):void 0}function b(e,t){const n=A(e);let r="";t?r=t:p(e)&&(r=e.name),r=void 0===n?r:`${r}[${n}]`;let i=e.parentNode;if(!i)return r;for(;i&&"FORM"!==i.nodeName;){if(v(i)&&i.name){const e=A(i);r=`${void 0===e?i.name:`${i.name}[${e}]`}.${r}`}i=i.parentNode}return r}function h(e){for(const t of e.elements)if(p(t)||v(t)){if(e.name&&t.name){const n=s(e),r=void 0===n?e.name:`${e.name}[${n}]`;t.dataset.felteFieldset=e.dataset.felteFieldset?`${e.dataset.felteFieldset}.${r}`:r}"true"!==e.dataset.felteUnsetOnRemove||t.hasAttribute("data-felte-unset-on-remove")||(t.dataset.felteUnsetOnRemove="true")}}function g(e){return e.type.match(/^(number|range)$/)?e.value?+e.value:void 0:e.value}function O(e,t){if(!p(e))return;const n=t;if(d(e)){if("checkbox"===e.type){const t=n;return void 0===t||"boolean"==typeof t?void(e.checked=!!t):void(Array.isArray(t)&&(t.includes(e.value)?e.checked=!0:e.checked=!1))}if("radio"===e.type){const t=n;return void(e.value===t?e.checked=!0:e.checked=!1)}if("file"===e.type)return e.files=null,void(e.value="")}e.value=String(n||"")}function j(e,t){if(!r(e)&&!r(t)){if(null===e)return t;if(null===t)return e;if(e&&t)return Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),[...e,...t]}}e._cloneDeep=i,e._defaultsDeep=function(...e){return u(...e,a)},e._get=c,e._isPlainObject=r,e._mapValues=n,e._merge=function(...e){return u(...e,(()=>{}))},e._mergeWith=u,e._set=f,e._some=t,e._unset=function(e,t){var n;if(Object(e)!==e)return;void 0!==e&&(e=i(e));let r=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g)||[];return null===(n=r.slice(0,-1).reduce(((e,t)=>Object(e[t])===e[t]?e[t]:void 0),e))||void 0===n||delete n[r[r.length-1]],e},e._update=l,e.addAttrsFromFieldset=h,e.deepSet=o,e.deepSome=function e(n,i){return t(n,(t=>r(t)?e(t,i):i(t)))},e.executeValidation=async function(e,t){if(!t)return;return Array.isArray(t)?u(...await Promise.all(t.map((t=>t(e)))),j):t(e)},e.getFormControls=function e(t){if(p(t))return[t];if(0===t.childElementCount)return[];const n=new Set;for(const r of t.children){if(p(r)&&n.add(r),v(r))for(const e of r.elements)p(e)&&n.add(e);r.childElementCount>0&&e(r).forEach((e=>n.add(e)))}return Array.from(n)},e.getFormDefaultValues=function(e){var t;let n={};for(const r of e.elements){if(v(r)&&h(r),!p(r)||!r.name)continue;const i=b(r),o=s(r);if(d(r)){if("checkbox"===r.type){if(void 0===c(n,i)){if(1===Array.from(e.querySelectorAll(`[name="${r.name}"]`)).filter((e=>{if(!p(e))return!1;if(void 0!==o){return Number(e.dataset.felteIndex)===o}return i===b(e)})).length){n=f(n,i,r.checked);continue}n=f(n,i,r.checked?[r.value]:[]);continue}Array.isArray(c(n,i))&&r.checked&&l(n,i,(e=>(void 0===o||Array.isArray(e)||(e=[]),[...e,r.value])));continue}if("radio"===r.type){if(c(n,i))continue;n=f(n,i,r.checked?r.value:void 0);continue}if("file"===r.type){n=f(n,i,r.multiple?Array.from(r.files||[]):null===(t=r.files)||void 0===t?void 0:t[0]);continue}}const u=g(r);n=f(n,i,u)}return{defaultData:n}},e.getIndex=s,e.getInputTextOrNumber=g,e.getPath=b,e.isElement=function(e){return e.nodeType===Node.ELEMENT_NODE},e.isFieldSetElement=v,e.isFieldValue=function(e){return Array.isArray(e)?0===e.length||e.some((e=>e instanceof File||"string"==typeof e)):"string"==typeof e||"number"==typeof e||"boolean"==typeof e||e instanceof File},e.isFormControl=p,e.isInputElement=d,e.isSelectElement=y,e.isTextAreaElement=m,e.setControlValue=O,e.setForm=function(e,t){for(const n of e.elements){if(v(n)&&h(n),!p(n)||!n.name)continue;O(n,c(t,b(n)))}},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Common={})}(this,(function(e){"use strict";function t(e,t){return Object.keys(e).some((n=>t(e[n])))}function n(e,t){return Object.keys(e).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:t(e[r])})),{})}function r(e){return"[object Object]"===Object.prototype.toString.call(e)}function i(e){return Object.keys(e||{}).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:r(e[n])?i(e[n]):Array.isArray(e[n])?[...e[n]]:e[n]})),{})}function o(e,t){return n(e,(e=>r(e)?o(e,t):Array.isArray(e)?e.map(function(e){return function(t){return r(t)?o(t,e):e}}(t)):t))}function u(...e){const t=e.pop(),n=i(e.shift());if(0===e.length)return n;for(const a of e){if(!a)continue;const e=Object.keys(a);for(const c of e){const e=t(n[c],a[c]);if(void 0!==e)n[c]=e;else if(r(a[c])&&r(n[c]))n[c]=u(n[c],a[c],t);else if(Array.isArray(a[c])&&Array.isArray(n[c]))n[c]=a[c].map(((e,r)=>u(n[c][r],e,t)));else if(r(a[c])){const e=o(i(a[c]),void 0);n[c]=u(e,a[c],t)}else void 0!==a[c]&&(n[c]=a[c])}}return n}function a(e,t){if(!r(e)||!r(t)){if(Array.isArray(t)){if(t.some(r))return;const n=Array.isArray(e)?e:[];return t.map(((e,t)=>{var r;return null!==(r=n[t])&&void 0!==r?r:e}))}return void 0!==e?e:void 0}}function c(e,t,n){const r=n=>String.prototype.split.call(t,n).filter(Boolean).reduce(((e,t)=>null!=e?e[t]:e),e),i=r(/[,[\]]+?/)||r(/[,[\].]+?/);return void 0===i||i===e?n:i}function f(e,t,n){Object(e)!==e?e={}:void 0!==e&&(e=i(e));let r=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g)||[];return r.slice(0,-1).reduce(((e,t,n)=>Object(e[t])===e[t]?e[t]:e[t]=Math.abs(Number(r[n+1]))>>0==+r[n+1]?[]:{}),e)[r[r.length-1]]=n,e}function l(e,t,n){Object(e)!==e&&(e={});let r=t.toString().match(/[^.[\]]+/g)||[];return r.slice(0,-1).reduce(((e,t,n)=>Object(e[t])===e[t]?e[t]:e[t]=Math.abs(Number(r[n+1]))>>0==+r[n+1]?[]:{}),e)[r[r.length-1]]=n(c(e,t)),e}function s(e){return e.hasAttribute("data-felte-index")?Number(e.dataset.felteIndex):void 0}function d(e){var t;return"INPUT"===(null===(t=e)||void 0===t?void 0:t.nodeName)}function m(e){var t;return"TEXTAREA"===(null===(t=e)||void 0===t?void 0:t.nodeName)}function y(e){var t;return"SELECT"===(null===(t=e)||void 0===t?void 0:t.nodeName)}function v(e){var t;return"FIELDSET"===(null===(t=e)||void 0===t?void 0:t.nodeName)}function p(e){return d(e)||m(e)||y(e)}function A(e,t){const n=s(e);let r="";t?r=t:p(e)&&(r=e.name),r=void 0===n?r:`${r}[${n}]`;let i=e.parentNode;if(!i)return r;for(;i&&"FORM"!==i.nodeName;){if(v(i)&&i.name){const e=s(i);r=`${void 0===e?i.name:`${i.name}[${e}]`}.${r}`}i=i.parentNode}return r}function b(e){for(const t of e.elements)if(p(t)||v(t)){if(e.name&&t.name){const n=s(e),r=void 0===n?e.name:`${e.name}[${n}]`;t.dataset.felteFieldset=e.dataset.felteFieldset?`${e.dataset.felteFieldset}.${r}`:r}"true"!==e.dataset.felteUnsetOnRemove||t.hasAttribute("data-felte-unset-on-remove")||(t.dataset.felteUnsetOnRemove="true")}}function h(e){return e.type.match(/^(number|range)$/)?e.value?+e.value:void 0:e.value}function g(e,t){if(!p(e))return;const n=t;if(d(e)){if("checkbox"===e.type){const t=n;return void 0===t||"boolean"==typeof t?void(e.checked=!!t):void(Array.isArray(t)&&(t.includes(e.value)?e.checked=!0:e.checked=!1))}if("radio"===e.type){const t=n;return void(e.value===t?e.checked=!0:e.checked=!1)}if("file"===e.type)return e.files=null,void(e.value="")}e.value=String(n||"")}function O(e,t){if(!r(e)&&!r(t)){if(null===e)return t;if(null===t)return e;if(e&&t)return Array.isArray(e)||(e=[e]),Array.isArray(t)||(t=[t]),[...e,...t]}}e._cloneDeep=i,e._defaultsDeep=function(...e){return u(...e,a)},e._get=c,e._isPlainObject=r,e._mapValues=n,e._merge=function(...e){return u(...e,(()=>{}))},e._mergeWith=u,e._set=f,e._some=t,e._unset=function(e,t){var n;if(Object(e)!==e)return;void 0!==e&&(e=i(e));let r=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g)||[];return null===(n=r.slice(0,-1).reduce(((e,t)=>Object(e[t])===e[t]?e[t]:void 0),e))||void 0===n||delete n[r[r.length-1]],e},e._update=l,e.addAttrsFromFieldset=b,e.deepSet=o,e.deepSome=function e(n,i){return t(n,(t=>r(t)?e(t,i):i(t)))},e.executeValidation=async function(e,t){if(!t)return;return Array.isArray(t)?u(...await Promise.all(t.map((t=>t(e)))),O):t(e)},e.getFormControls=function e(t){if(p(t))return[t];if(0===t.childElementCount)return[];const n=new Set;for(const r of t.children){if(p(r)&&n.add(r),v(r))for(const e of r.elements)p(e)&&n.add(e);r.childElementCount>0&&e(r).forEach((e=>n.add(e)))}return Array.from(n)},e.getFormDefaultValues=function(e){var t;let n={};for(const r of e.elements){if(v(r)&&b(r),!p(r)||!r.name)continue;const i=A(r),o=s(r);if(d(r)){if("checkbox"===r.type){if(void 0===c(n,i)){if(1===Array.from(e.querySelectorAll(`[name="${r.name}"]`)).filter((e=>{if(!p(e))return!1;if(void 0!==o){return Number(e.dataset.felteIndex)===o}return i===A(e)})).length){n=f(n,i,r.checked);continue}n=f(n,i,r.checked?[r.value]:[]);continue}Array.isArray(c(n,i))&&r.checked&&l(n,i,(e=>(void 0===o||Array.isArray(e)||(e=[]),[...e,r.value])));continue}if("radio"===r.type){if(c(n,i))continue;n=f(n,i,r.checked?r.value:void 0);continue}if("file"===r.type){n=f(n,i,r.multiple?Array.from(r.files||[]):null===(t=r.files)||void 0===t?void 0:t[0]);continue}}const u=h(r);n=f(n,i,u)}return{defaultData:n}},e.getIndex=s,e.getInputTextOrNumber=h,e.getPath=A,e.getPathFromDataset=function(e){const t=e.dataset.felteFieldset,n=s(e),r=void 0===n?e.name:`${e.name}[${n}]`;return t?`${t}.${r}`:r},e.isElement=function(e){return e.nodeType===Node.ELEMENT_NODE},e.isFieldSetElement=v,e.isFieldValue=function(e){return Array.isArray(e)?0===e.length||e.some((e=>e instanceof File||"string"==typeof e)):"string"==typeof e||"number"==typeof e||"boolean"==typeof e||e instanceof File},e.isFormControl=p,e.isInputElement=d,e.isSelectElement=y,e.isTextAreaElement=m,e.setControlValue=g,e.setForm=function(e,t){for(const n of e.elements){if(v(n)&&b(n),!p(n)||!n.name)continue;g(n,c(t,A(n)))}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.js.map
{
"name": "@felte/common",
"version": "0.4.6",
"version": "0.4.7",
"description": "Common utilities for Felte packages",

@@ -5,0 +5,0 @@ "author": "Pablo Berganza <pablo@berganza.dev>",

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