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.3.2 to 0.3.3

6

CHANGELOG.md
# @felte/common
## 0.3.3
### Patch Changes
- 5df429d: Fix \_get not being able to retrieve objects
## 0.3.2

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

4

dist/index.d.ts

@@ -114,2 +114,4 @@ import { Readable, Writable } from "svelte/store";

};
/** @category Helper */
declare function isFieldValue(value: unknown): value is FieldValue;
/** @ignore */

@@ -186,3 +188,3 @@ declare function _some(obj: Obj, pred: (value: unknown) => boolean): boolean;

declare function executeValidation<Data extends Obj>(values: Data, validations?: ValidationFunction<Data>[] | ValidationFunction<Data>): Promise<ReturnType<ValidationFunction<Data>>>;
export { _some, _mapValues, _get, _set, _unset, _update, _isPlainObject, deepSet, deepSome, isInputElement, isTextAreaElement, isSelectElement, isFieldSetElement, isFormControl, isElement, getPath, getFormControls, addAttrsFromFieldset, getInputTextOrNumber, getFormDefaultValues, setControlValue, setForm, executeValidation, CreateSubmitHandlerConfig, CurrentForm, OnSubmitErrorState, ReporterHandler, Reporter, ExtenderHandler, Extender, Obj, FieldValue, FormControl, ValidationFunction, FormConfigWithoutInitialValues, FormConfigWithInitialValues, FormConfig, Errors, Touched, FormAction, Stores, Form };
export { isFieldValue, _some, _mapValues, _get, _set, _unset, _update, _isPlainObject, deepSet, deepSome, isInputElement, isTextAreaElement, isSelectElement, isFieldSetElement, isFormControl, isElement, getPath, getFormControls, addAttrsFromFieldset, getInputTextOrNumber, getFormDefaultValues, setControlValue, setForm, executeValidation, CreateSubmitHandlerConfig, CurrentForm, OnSubmitErrorState, ReporterHandler, Reporter, ExtenderHandler, Extender, Obj, FieldValue, FormControl, ValidationFunction, FormConfigWithoutInitialValues, FormConfigWithInitialValues, FormConfig, Errors, Touched, FormAction, Stores, Form };
//# sourceMappingURL=index.d.ts.map

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Common={})}(this,(function(t){"use strict";function e(t,e){return t===e||t!=t&&e!=e}function n(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}var r=Array.prototype.splice;function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}o.prototype.clear=function(){this.__data__=[],this.size=0},o.prototype.delete=function(t){var e=this.__data__,o=n(e,t);return!(o<0)&&(o==e.length-1?e.pop():r.call(e,o,1),--this.size,!0)},o.prototype.get=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]},o.prototype.has=function(t){return n(this.__data__,t)>-1},o.prototype.set=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this};var i="object"==typeof global&&global&&global.Object===Object&&global,u="object"==typeof self&&self&&self.Object===Object&&self,a=i||u||Function("return this")(),c=a.Symbol,f=Object.prototype,l=f.hasOwnProperty,s=f.toString,p=c?c.toStringTag:void 0;var d=Object.prototype.toString;var v=c?c.toStringTag:void 0;function y(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":v&&v in Object(t)?function(t){var e=l.call(t,p),n=t[p];try{t[p]=void 0;var r=!0}catch(t){}var o=s.call(t);return r&&(e?t[p]=n:delete t[p]),o}(t):function(t){return d.call(t)}(t)}function h(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function b(t){if(!h(t))return!1;var e=y(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var _,g=a["__core-js_shared__"],j=(_=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||""))?"Symbol(src)_1."+_:"";var m=Function.prototype.toString;var O=/^\[object .+?Constructor\]$/,A=Function.prototype,w=Object.prototype,F=A.toString,E=w.hasOwnProperty,S=RegExp("^"+F.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function T(t){return!(!h(t)||(e=t,j&&j in e))&&(b(t)?S:O).test(function(t){if(null!=t){try{return m.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function z(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return T(n)?n:void 0}var P=z(a,"Map"),k=z(Object,"create");var x=Object.prototype.hasOwnProperty;var $=Object.prototype.hasOwnProperty;function N(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function U(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function C(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}N.prototype.clear=function(){this.__data__=k?k(null):{},this.size=0},N.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},N.prototype.get=function(t){var e=this.__data__;if(k){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return x.call(e,t)?e[t]:void 0},N.prototype.has=function(t){var e=this.__data__;return k?void 0!==e[t]:$.call(e,t)},N.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=k&&void 0===e?"__lodash_hash_undefined__":e,this},C.prototype.clear=function(){this.size=0,this.__data__={hash:new N,map:new(P||o),string:new N}},C.prototype.delete=function(t){var e=U(this,t).delete(t);return this.size-=e?1:0,e},C.prototype.get=function(t){return U(this,t).get(t)},C.prototype.has=function(t){return U(this,t).has(t)},C.prototype.set=function(t,e){var n=U(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function I(t){var e=this.__data__=new o(t);this.size=e.size}I.prototype.clear=function(){this.__data__=new o,this.size=0},I.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},I.prototype.get=function(t){return this.__data__.get(t)},I.prototype.has=function(t){return this.__data__.has(t)},I.prototype.set=function(t,e){var n=this.__data__;if(n instanceof o){var r=n.__data__;if(!P||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new C(r)}return n.set(t,e),this.size=n.size,this};var D=function(){try{var t=z(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();function M(t,e,n){"__proto__"==e&&D?D(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function R(t,n,r){(void 0!==r&&!e(t[n],r)||void 0===r&&!(n in t))&&M(t,n,r)}var B,L=function(t,e,n){for(var r=-1,o=Object(t),i=n(t),u=i.length;u--;){var a=i[B?u:++r];if(!1===e(o[a],a,o))break}return t},V="object"==typeof t&&t&&!t.nodeType&&t,q=V&&"object"==typeof module&&module&&!module.nodeType&&module,G=q&&q.exports===V?a.Buffer:void 0,W=G?G.allocUnsafe:void 0;var X=a.Uint8Array;function H(t,e){var n,r,o=e?(n=t.buffer,r=new n.constructor(n.byteLength),new X(r).set(new X(n)),r):t.buffer;return new t.constructor(o,t.byteOffset,t.length)}var J=Object.create,K=function(){function t(){}return function(e){if(!h(e))return{};if(J)return J(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var Q,Y,Z=(Q=Object.getPrototypeOf,Y=Object,function(t){return Q(Y(t))}),tt=Object.prototype;function et(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||tt)}function nt(t){return null!=t&&"object"==typeof t}function rt(t){return nt(t)&&"[object Arguments]"==y(t)}var ot=Object.prototype,it=ot.hasOwnProperty,ut=ot.propertyIsEnumerable,at=rt(function(){return arguments}())?rt:function(t){return nt(t)&&it.call(t,"callee")&&!ut.call(t,"callee")},ct=Array.isArray;function ft(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function lt(t){return null!=t&&ft(t.length)&&!b(t)}var st="object"==typeof t&&t&&!t.nodeType&&t,pt=st&&"object"==typeof module&&module&&!module.nodeType&&module,dt=pt&&pt.exports===st?a.Buffer:void 0,vt=(dt?dt.isBuffer:void 0)||function(){return!1},yt=Function.prototype,ht=Object.prototype,bt=yt.toString,_t=ht.hasOwnProperty,gt=bt.call(Object);var jt={};jt["[object Float32Array]"]=jt["[object Float64Array]"]=jt["[object Int8Array]"]=jt["[object Int16Array]"]=jt["[object Int32Array]"]=jt["[object Uint8Array]"]=jt["[object Uint8ClampedArray]"]=jt["[object Uint16Array]"]=jt["[object Uint32Array]"]=!0,jt["[object Arguments]"]=jt["[object Array]"]=jt["[object ArrayBuffer]"]=jt["[object Boolean]"]=jt["[object DataView]"]=jt["[object Date]"]=jt["[object Error]"]=jt["[object Function]"]=jt["[object Map]"]=jt["[object Number]"]=jt["[object Object]"]=jt["[object RegExp]"]=jt["[object Set]"]=jt["[object String]"]=jt["[object WeakMap]"]=!1;var mt="object"==typeof t&&t&&!t.nodeType&&t,Ot=mt&&"object"==typeof module&&module&&!module.nodeType&&module,At=Ot&&Ot.exports===mt&&i.process,wt=function(){try{var t=Ot&&Ot.require&&Ot.require("util").types;return t||At&&At.binding&&At.binding("util")}catch(t){}}(),Ft=wt&&wt.isTypedArray,Et=Ft?function(t){return function(e){return t(e)}}(Ft):function(t){return nt(t)&&ft(t.length)&&!!jt[y(t)]};function St(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Tt=Object.prototype.hasOwnProperty;function zt(t,n,r){var o=t[n];Tt.call(t,n)&&e(o,r)&&(void 0!==r||n in t)||M(t,n,r)}var Pt=/^(?:0|[1-9]\d*)$/;function kt(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Pt.test(t))&&t>-1&&t%1==0&&t<e}var xt=Object.prototype.hasOwnProperty;function $t(t,e){var n=ct(t),r=!n&&at(t),o=!n&&!r&&vt(t),i=!n&&!r&&!o&&Et(t),u=n||r||o||i,a=u?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var f in t)!e&&!xt.call(t,f)||u&&("length"==f||o&&("offset"==f||"parent"==f)||i&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||kt(f,c))||a.push(f);return a}var Nt=Object.prototype.hasOwnProperty;function Ut(t){if(!h(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=et(t),n=[];for(var r in t)("constructor"!=r||!e&&Nt.call(t,r))&&n.push(r);return n}function Ct(t){return lt(t)?$t(t,!0):Ut(t)}function It(t){return function(t,e,n,r){var o=!n;n||(n={});for(var i=-1,u=e.length;++i<u;){var a=e[i],c=r?r(n[a],t[a],a,n,t):void 0;void 0===c&&(c=t[a]),o?M(n,a,c):zt(n,a,c)}return n}(t,Ct(t))}function Dt(t,e,n,r,o,i,u){var a=St(t,n),c=St(e,n),f=u.get(c);if(f)R(t,n,f);else{var l,s=i?i(a,c,n+"",t,e,u):void 0,p=void 0===s;if(p){var d=ct(c),v=!d&&vt(c),_=!d&&!v&&Et(c);s=c,d||v||_?ct(a)?s=a:nt(l=a)&&lt(l)?s=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(a):v?(p=!1,s=function(t,e){if(e)return t.slice();var n=t.length,r=W?W(n):new t.constructor(n);return t.copy(r),r}(c,!0)):_?(p=!1,s=H(c,!0)):s=[]:function(t){if(!nt(t)||"[object Object]"!=y(t))return!1;var e=Z(t);if(null===e)return!0;var n=_t.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&bt.call(n)==gt}(c)||at(c)?(s=a,at(a)?s=It(a):h(a)&&!b(a)||(s=function(t){return"function"!=typeof t.constructor||et(t)?{}:K(Z(t))}(c))):p=!1}p&&(u.set(c,s),o(s,c,r,i,u),u.delete(c)),R(t,n,s)}}function Mt(t,e,n,r,o){t!==e&&L(e,(function(i,u){if(o||(o=new I),h(i))Dt(t,e,u,n,Mt,r,o);else{var a=r?r(St(t,u),i,u+"",t,e,o):void 0;void 0===a&&(a=i),R(t,u,a)}}),Ct)}function Rt(t){return t}function Bt(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var Lt=Math.max;var Vt=D?function(t,e){return D(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Rt,qt=Date.now;var Gt=function(t){var e=0,n=0;return function(){var r=qt(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Vt);function Wt(t,e){return Gt(function(t,e,n){return e=Lt(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Lt(r.length-e,0),u=Array(i);++o<i;)u[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=n(u),Bt(t,this,a)}}(t,e,Rt),t+"")}var Xt,Ht=(Xt=function(t,e,n,r){Mt(t,e,n,r)},Wt((function(t,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,u=o>2?n[2]:void 0;for(i=Xt.length>3&&"function"==typeof i?(o--,i):void 0,u&&function(t,n,r){if(!h(r))return!1;var o=typeof n;return!!("number"==o?lt(r)&&kt(n,r.length):"string"==o&&n in r)&&e(r[n],t)}(n[0],n[1],u)&&(i=o<3?void 0:i,o=1),t=Object(t);++r<o;){var a=n[r];a&&Xt(t,a,r,i)}return t})));function Jt(t,e){return Object.keys(t).some((n=>e(t[n])))}function Kt(t,e){return Object.keys(t).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:e(t[r])})),{})}function Qt(t,e,n){const r=e.split(".");let o=t;try{for(const t of r)o=o[t]}catch(t){return n}return function(t){return Array.isArray(t)?0===t.length||t.some((t=>t instanceof File||"string"==typeof t)):"string"==typeof t||"number"==typeof t||"boolean"==typeof t||t instanceof File}(o)?o:n}function Yt(t,e,n){null!=t||(t={});const r=e.split(".");let o=t;for(;r.length-1;){const t=r.shift();t&&(t in o||(o[t]={}),o=o[t])}return o[r[0]]=n,t}function Zt(t,e,n){const r=e.split(".");let o=t;for(;r.length-1;){const t=r.shift();t&&(t in o||(o[t]={}),o=o[t])}return o[r[0]]=n(o[r[0]]),t}function te(t){return"[object Object]"===Object.prototype.toString.call(t)}function ee(t){var e;return"INPUT"===(null===(e=t)||void 0===e?void 0:e.nodeName)}function ne(t){var e;return"TEXTAREA"===(null===(e=t)||void 0===e?void 0:e.nodeName)}function re(t){var e;return"SELECT"===(null===(e=t)||void 0===e?void 0:e.nodeName)}function oe(t){var e;return"FIELDSET"===(null===(e=t)||void 0===e?void 0:e.nodeName)}function ie(t){return ee(t)||ne(t)||re(t)}function ue(t){const e=t.dataset.felteFieldset;return e?`${e}.${t.name}`:t.name}function ae(t){for(const e of t.elements)(ie(e)||oe(e))&&(t.name&&e.name&&(e.dataset.felteFieldset=t.dataset.felteFieldset?`${t.dataset.felteFieldset}.${t.name}`:t.name),"true"!==t.dataset.felteUnsetOnRemove||e.hasAttribute("data-felte-unset-on-remove")||(e.dataset.felteUnsetOnRemove="true"))}function ce(t){return t.type.match(/^(number|range)$/)?t.value?+t.value:void 0:t.value}function fe(t,e){if(ee(t)&&"checkbox"===t.type){const n=e;return void 0===n||"boolean"==typeof n?void(t.checked=!!n):void(Array.isArray(n)&&(n.includes(t.value)?t.checked=!0:t.checked=!1))}if(ee(t)&&"radio"===t.type){const n=e;t.value===n?t.checked=!0:t.checked=!1}else{if(ee(t)&&"file"===t.type)return t.files=null,void(t.value="");t.value=String(e||"")}}function le(t,e){if(!te(t)&&!te(e)){if(null===t)return e;if(null===e)return t;if(t&&e)return Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]),[...t,...e]}}t._get=Qt,t._isPlainObject=te,t._mapValues=Kt,t._set=Yt,t._some=Jt,t._unset=function(t,e){const n=e.split(".");let r=t;for(;n.length-1;){const t=n.shift();t&&(t in r||(r[t]={}),r=r[t])}return delete r[n[0]],t},t._update=Zt,t.addAttrsFromFieldset=ae,t.deepSet=function t(e,n){return Kt(e,(e=>te(e)?t(e,n):n))},t.deepSome=function t(e,n){return Jt(e,(e=>te(e)?t(e,n):n(e)))},t.executeValidation=async function(t,e){if(!e)return;if(!Array.isArray(e))return e(t);const n=await Promise.all(e.map((e=>e(t))));return Ht({},...n,le)},t.getFormControls=function t(e){if(ie(e))return[e];if(0===e.childElementCount)return[];const n=new Set;for(const r of e.children){if(ie(r)&&n.add(r),oe(r))for(const t of r.elements)ie(t)&&n.add(t);r.childElementCount>0&&t(r).forEach((t=>n.add(t)))}return Array.from(n)},t.getFormDefaultValues=function(t){var e;const n={},r={};for(const o of t.elements){if(oe(o)&&ae(o),!ie(o)||!o.name)continue;const i=ue(o);if(Yt(r,i,!1),ee(o)&&"checkbox"===o.type){if(void 0===Qt(n,i)){if(1===t.querySelectorAll(`[name="${o.name}"]`).length){Yt(n,i,o.checked);continue}Yt(n,i,o.checked?[o.value]:[]);continue}Array.isArray(Qt(n,i))&&o.checked&&Zt(n,i,(t=>[...t,o.value]));continue}if(ee(o)&&"radio"===o.type){if(Qt(n,i))continue;Yt(n,i,o.checked?o.value:void 0);continue}if(ee(o)&&"file"===o.type){Yt(n,i,o.multiple?Array.from(o.files||[]):null===(e=o.files)||void 0===e?void 0:e[0]);continue}Yt(n,i,ce(o))}return{defaultData:n,defaultTouched:r}},t.getInputTextOrNumber=ce,t.getPath=ue,t.isElement=function(t){return t.nodeType===Node.ELEMENT_NODE},t.isFieldSetElement=oe,t.isFormControl=ie,t.isInputElement=ee,t.isSelectElement=re,t.isTextAreaElement=ne,t.setControlValue=fe,t.setForm=function(t,e){for(const n of t.elements){if(oe(n)&&ae(n),!ie(n)||!n.name)continue;fe(n,Qt(e,ue(n)))}},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Common={})}(this,(function(t){"use strict";function e(t,e){return t===e||t!=t&&e!=e}function n(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}var r=Array.prototype.splice;function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}o.prototype.clear=function(){this.__data__=[],this.size=0},o.prototype.delete=function(t){var e=this.__data__,o=n(e,t);return!(o<0)&&(o==e.length-1?e.pop():r.call(e,o,1),--this.size,!0)},o.prototype.get=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]},o.prototype.has=function(t){return n(this.__data__,t)>-1},o.prototype.set=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this};var i="object"==typeof global&&global&&global.Object===Object&&global,u="object"==typeof self&&self&&self.Object===Object&&self,a=i||u||Function("return this")(),c=a.Symbol,f=Object.prototype,l=f.hasOwnProperty,s=f.toString,p=c?c.toStringTag:void 0;var d=Object.prototype.toString;var v=c?c.toStringTag:void 0;function y(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":v&&v in Object(t)?function(t){var e=l.call(t,p),n=t[p];try{t[p]=void 0;var r=!0}catch(t){}var o=s.call(t);return r&&(e?t[p]=n:delete t[p]),o}(t):function(t){return d.call(t)}(t)}function h(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function b(t){if(!h(t))return!1;var e=y(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var _,g=a["__core-js_shared__"],j=(_=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||""))?"Symbol(src)_1."+_:"";var m=Function.prototype.toString;var O=/^\[object .+?Constructor\]$/,A=Function.prototype,w=Object.prototype,F=A.toString,E=w.hasOwnProperty,S=RegExp("^"+F.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function T(t){return!(!h(t)||(e=t,j&&j in e))&&(b(t)?S:O).test(function(t){if(null!=t){try{return m.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function z(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return T(n)?n:void 0}var P=z(a,"Map"),k=z(Object,"create");var x=Object.prototype.hasOwnProperty;var $=Object.prototype.hasOwnProperty;function N(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function U(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function C(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}N.prototype.clear=function(){this.__data__=k?k(null):{},this.size=0},N.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},N.prototype.get=function(t){var e=this.__data__;if(k){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return x.call(e,t)?e[t]:void 0},N.prototype.has=function(t){var e=this.__data__;return k?void 0!==e[t]:$.call(e,t)},N.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=k&&void 0===e?"__lodash_hash_undefined__":e,this},C.prototype.clear=function(){this.size=0,this.__data__={hash:new N,map:new(P||o),string:new N}},C.prototype.delete=function(t){var e=U(this,t).delete(t);return this.size-=e?1:0,e},C.prototype.get=function(t){return U(this,t).get(t)},C.prototype.has=function(t){return U(this,t).has(t)},C.prototype.set=function(t,e){var n=U(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function I(t){var e=this.__data__=new o(t);this.size=e.size}I.prototype.clear=function(){this.__data__=new o,this.size=0},I.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},I.prototype.get=function(t){return this.__data__.get(t)},I.prototype.has=function(t){return this.__data__.has(t)},I.prototype.set=function(t,e){var n=this.__data__;if(n instanceof o){var r=n.__data__;if(!P||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new C(r)}return n.set(t,e),this.size=n.size,this};var D=function(){try{var t=z(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();function M(t,e,n){"__proto__"==e&&D?D(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function R(t,n,r){(void 0!==r&&!e(t[n],r)||void 0===r&&!(n in t))&&M(t,n,r)}var V,B=function(t,e,n){for(var r=-1,o=Object(t),i=n(t),u=i.length;u--;){var a=i[V?u:++r];if(!1===e(o[a],a,o))break}return t},L="object"==typeof t&&t&&!t.nodeType&&t,q=L&&"object"==typeof module&&module&&!module.nodeType&&module,G=q&&q.exports===L?a.Buffer:void 0,W=G?G.allocUnsafe:void 0;var X=a.Uint8Array;function H(t,e){var n,r,o=e?(n=t.buffer,r=new n.constructor(n.byteLength),new X(r).set(new X(n)),r):t.buffer;return new t.constructor(o,t.byteOffset,t.length)}var J=Object.create,K=function(){function t(){}return function(e){if(!h(e))return{};if(J)return J(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var Q,Y,Z=(Q=Object.getPrototypeOf,Y=Object,function(t){return Q(Y(t))}),tt=Object.prototype;function et(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||tt)}function nt(t){return null!=t&&"object"==typeof t}function rt(t){return nt(t)&&"[object Arguments]"==y(t)}var ot=Object.prototype,it=ot.hasOwnProperty,ut=ot.propertyIsEnumerable,at=rt(function(){return arguments}())?rt:function(t){return nt(t)&&it.call(t,"callee")&&!ut.call(t,"callee")},ct=Array.isArray;function ft(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function lt(t){return null!=t&&ft(t.length)&&!b(t)}var st="object"==typeof t&&t&&!t.nodeType&&t,pt=st&&"object"==typeof module&&module&&!module.nodeType&&module,dt=pt&&pt.exports===st?a.Buffer:void 0,vt=(dt?dt.isBuffer:void 0)||function(){return!1},yt=Function.prototype,ht=Object.prototype,bt=yt.toString,_t=ht.hasOwnProperty,gt=bt.call(Object);var jt={};jt["[object Float32Array]"]=jt["[object Float64Array]"]=jt["[object Int8Array]"]=jt["[object Int16Array]"]=jt["[object Int32Array]"]=jt["[object Uint8Array]"]=jt["[object Uint8ClampedArray]"]=jt["[object Uint16Array]"]=jt["[object Uint32Array]"]=!0,jt["[object Arguments]"]=jt["[object Array]"]=jt["[object ArrayBuffer]"]=jt["[object Boolean]"]=jt["[object DataView]"]=jt["[object Date]"]=jt["[object Error]"]=jt["[object Function]"]=jt["[object Map]"]=jt["[object Number]"]=jt["[object Object]"]=jt["[object RegExp]"]=jt["[object Set]"]=jt["[object String]"]=jt["[object WeakMap]"]=!1;var mt="object"==typeof t&&t&&!t.nodeType&&t,Ot=mt&&"object"==typeof module&&module&&!module.nodeType&&module,At=Ot&&Ot.exports===mt&&i.process,wt=function(){try{var t=Ot&&Ot.require&&Ot.require("util").types;return t||At&&At.binding&&At.binding("util")}catch(t){}}(),Ft=wt&&wt.isTypedArray,Et=Ft?function(t){return function(e){return t(e)}}(Ft):function(t){return nt(t)&&ft(t.length)&&!!jt[y(t)]};function St(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Tt=Object.prototype.hasOwnProperty;function zt(t,n,r){var o=t[n];Tt.call(t,n)&&e(o,r)&&(void 0!==r||n in t)||M(t,n,r)}var Pt=/^(?:0|[1-9]\d*)$/;function kt(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Pt.test(t))&&t>-1&&t%1==0&&t<e}var xt=Object.prototype.hasOwnProperty;function $t(t,e){var n=ct(t),r=!n&&at(t),o=!n&&!r&&vt(t),i=!n&&!r&&!o&&Et(t),u=n||r||o||i,a=u?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],c=a.length;for(var f in t)!e&&!xt.call(t,f)||u&&("length"==f||o&&("offset"==f||"parent"==f)||i&&("buffer"==f||"byteLength"==f||"byteOffset"==f)||kt(f,c))||a.push(f);return a}var Nt=Object.prototype.hasOwnProperty;function Ut(t){if(!h(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=et(t),n=[];for(var r in t)("constructor"!=r||!e&&Nt.call(t,r))&&n.push(r);return n}function Ct(t){return lt(t)?$t(t,!0):Ut(t)}function It(t){return function(t,e,n,r){var o=!n;n||(n={});for(var i=-1,u=e.length;++i<u;){var a=e[i],c=r?r(n[a],t[a],a,n,t):void 0;void 0===c&&(c=t[a]),o?M(n,a,c):zt(n,a,c)}return n}(t,Ct(t))}function Dt(t,e,n,r,o,i,u){var a=St(t,n),c=St(e,n),f=u.get(c);if(f)R(t,n,f);else{var l,s=i?i(a,c,n+"",t,e,u):void 0,p=void 0===s;if(p){var d=ct(c),v=!d&&vt(c),_=!d&&!v&&Et(c);s=c,d||v||_?ct(a)?s=a:nt(l=a)&&lt(l)?s=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(a):v?(p=!1,s=function(t,e){if(e)return t.slice();var n=t.length,r=W?W(n):new t.constructor(n);return t.copy(r),r}(c,!0)):_?(p=!1,s=H(c,!0)):s=[]:function(t){if(!nt(t)||"[object Object]"!=y(t))return!1;var e=Z(t);if(null===e)return!0;var n=_t.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&bt.call(n)==gt}(c)||at(c)?(s=a,at(a)?s=It(a):h(a)&&!b(a)||(s=function(t){return"function"!=typeof t.constructor||et(t)?{}:K(Z(t))}(c))):p=!1}p&&(u.set(c,s),o(s,c,r,i,u),u.delete(c)),R(t,n,s)}}function Mt(t,e,n,r,o){t!==e&&B(e,(function(i,u){if(o||(o=new I),h(i))Dt(t,e,u,n,Mt,r,o);else{var a=r?r(St(t,u),i,u+"",t,e,o):void 0;void 0===a&&(a=i),R(t,u,a)}}),Ct)}function Rt(t){return t}function Vt(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var Bt=Math.max;var Lt=D?function(t,e){return D(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Rt,qt=Date.now;var Gt=function(t){var e=0,n=0;return function(){var r=qt(),o=16-(r-n);if(n=r,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Lt);function Wt(t,e){return Gt(function(t,e,n){return e=Bt(void 0===e?t.length-1:e,0),function(){for(var r=arguments,o=-1,i=Bt(r.length-e,0),u=Array(i);++o<i;)u[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=n(u),Vt(t,this,a)}}(t,e,Rt),t+"")}var Xt,Ht=(Xt=function(t,e,n,r){Mt(t,e,n,r)},Wt((function(t,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,u=o>2?n[2]:void 0;for(i=Xt.length>3&&"function"==typeof i?(o--,i):void 0,u&&function(t,n,r){if(!h(r))return!1;var o=typeof n;return!!("number"==o?lt(r)&&kt(n,r.length):"string"==o&&n in r)&&e(r[n],t)}(n[0],n[1],u)&&(i=o<3?void 0:i,o=1),t=Object(t);++r<o;){var a=n[r];a&&Xt(t,a,r,i)}return t})));function Jt(t,e){return Object.keys(t).some((n=>e(t[n])))}function Kt(t,e){return Object.keys(t).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:e(t[r])})),{})}function Qt(t,e,n){const r=e.split(".");let o=t;try{for(const t of r)o=o[t]}catch(t){return n}return void 0===o?n:o}function Yt(t,e,n){null!=t||(t={});const r=e.split(".");let o=t;for(;r.length-1;){const t=r.shift();t&&(t in o||(o[t]={}),o=o[t])}return o[r[0]]=n,t}function Zt(t,e,n){const r=e.split(".");let o=t;for(;r.length-1;){const t=r.shift();t&&(t in o||(o[t]={}),o=o[t])}return o[r[0]]=n(o[r[0]]),t}function te(t){return"[object Object]"===Object.prototype.toString.call(t)}function ee(t){var e;return"INPUT"===(null===(e=t)||void 0===e?void 0:e.nodeName)}function ne(t){var e;return"TEXTAREA"===(null===(e=t)||void 0===e?void 0:e.nodeName)}function re(t){var e;return"SELECT"===(null===(e=t)||void 0===e?void 0:e.nodeName)}function oe(t){var e;return"FIELDSET"===(null===(e=t)||void 0===e?void 0:e.nodeName)}function ie(t){return ee(t)||ne(t)||re(t)}function ue(t){const e=t.dataset.felteFieldset;return e?`${e}.${t.name}`:t.name}function ae(t){for(const e of t.elements)(ie(e)||oe(e))&&(t.name&&e.name&&(e.dataset.felteFieldset=t.dataset.felteFieldset?`${t.dataset.felteFieldset}.${t.name}`:t.name),"true"!==t.dataset.felteUnsetOnRemove||e.hasAttribute("data-felte-unset-on-remove")||(e.dataset.felteUnsetOnRemove="true"))}function ce(t){return t.type.match(/^(number|range)$/)?t.value?+t.value:void 0:t.value}function fe(t,e){if(ee(t)&&"checkbox"===t.type){const n=e;return void 0===n||"boolean"==typeof n?void(t.checked=!!n):void(Array.isArray(n)&&(n.includes(t.value)?t.checked=!0:t.checked=!1))}if(ee(t)&&"radio"===t.type){const n=e;t.value===n?t.checked=!0:t.checked=!1}else{if(ee(t)&&"file"===t.type)return t.files=null,void(t.value="");t.value=String(e||"")}}function le(t,e){if(!te(t)&&!te(e)){if(null===t)return e;if(null===e)return t;if(t&&e)return Array.isArray(t)||(t=[t]),Array.isArray(e)||(e=[e]),[...t,...e]}}t._get=Qt,t._isPlainObject=te,t._mapValues=Kt,t._set=Yt,t._some=Jt,t._unset=function(t,e){const n=e.split(".");let r=t;for(;n.length-1;){const t=n.shift();t&&(t in r||(r[t]={}),r=r[t])}return delete r[n[0]],t},t._update=Zt,t.addAttrsFromFieldset=ae,t.deepSet=function t(e,n){return Kt(e,(e=>te(e)?t(e,n):n))},t.deepSome=function t(e,n){return Jt(e,(e=>te(e)?t(e,n):n(e)))},t.executeValidation=async function(t,e){if(!e)return;if(!Array.isArray(e))return e(t);const n=await Promise.all(e.map((e=>e(t))));return Ht({},...n,le)},t.getFormControls=function t(e){if(ie(e))return[e];if(0===e.childElementCount)return[];const n=new Set;for(const r of e.children){if(ie(r)&&n.add(r),oe(r))for(const t of r.elements)ie(t)&&n.add(t);r.childElementCount>0&&t(r).forEach((t=>n.add(t)))}return Array.from(n)},t.getFormDefaultValues=function(t){var e;const n={},r={};for(const o of t.elements){if(oe(o)&&ae(o),!ie(o)||!o.name)continue;const i=ue(o);if(Yt(r,i,!1),ee(o)&&"checkbox"===o.type){if(void 0===Qt(n,i)){if(1===t.querySelectorAll(`[name="${o.name}"]`).length){Yt(n,i,o.checked);continue}Yt(n,i,o.checked?[o.value]:[]);continue}Array.isArray(Qt(n,i))&&o.checked&&Zt(n,i,(t=>[...t,o.value]));continue}if(ee(o)&&"radio"===o.type){if(Qt(n,i))continue;Yt(n,i,o.checked?o.value:void 0);continue}if(ee(o)&&"file"===o.type){Yt(n,i,o.multiple?Array.from(o.files||[]):null===(e=o.files)||void 0===e?void 0:e[0]);continue}Yt(n,i,ce(o))}return{defaultData:n,defaultTouched:r}},t.getInputTextOrNumber=ce,t.getPath=ue,t.isElement=function(t){return t.nodeType===Node.ELEMENT_NODE},t.isFieldSetElement=oe,t.isFieldValue=function(t){return Array.isArray(t)?0===t.length||t.some((t=>t instanceof File||"string"==typeof t)):"string"==typeof t||"number"==typeof t||"boolean"==typeof t||t instanceof File},t.isFormControl=ie,t.isInputElement=ee,t.isSelectElement=re,t.isTextAreaElement=ne,t.setControlValue=fe,t.setForm=function(t,e){for(const n of t.elements){if(oe(n)&&ae(n),!ie(n)||!n.name)continue;fe(n,Qt(e,ue(n)))}},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.js.map
{
"name": "@felte/common",
"version": "0.3.2",
"version": "0.3.3",
"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