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

vest-utils

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vest-utils - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

23

dist/cjs/vest-utils.development.js

@@ -248,3 +248,3 @@ 'use strict';

let state = machine.initial;
const api = { getState, transition, staticTransition };
const api = { getState, initial, staticTransition, transition };
return api;

@@ -254,2 +254,5 @@ function getState() {

}
function initial() {
return machine.initial;
}
function transition(action, payload) {

@@ -309,2 +312,20 @@ return (state = staticTransition(state, action, payload));

function all(...p) {
return (value) => isEmpty(p)
? false
: p.every(predicate => optionalFunctionValue(predicate, value));
}
function any(...p) {
return (value) => isEmpty(p)
? false
: p.some(predicate => optionalFunctionValue(predicate, value));
}
var Predicates = /*#__PURE__*/Object.freeze({
__proto__: null,
all: all,
any: any
});
exports.Predicates = Predicates;
exports.StateMachine = StateMachine;

@@ -311,0 +332,0 @@ exports.StringObject = StringObject;

2

dist/cjs/vest-utils.production.js

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

"use strict";function t(t){return(...n)=>!t(...n)}function n(t){const n=String(t),r=Number(t),e=!isNaN(parseFloat(n))&&!isNaN(Number(t))&&isFinite(r);return Boolean(e)}const r=t(n);function e(t,r){return n(t)&&n(r)&&Number(t)===Number(r)}const o=t(e);function i(t,n){return e(t.length,n)}const u=t(i);function s(t,r){return n(t)&&n(r)&&Number(t)>Number(r)}function c(t,n){return s(t.length,n)}function a(t){return null===t}const f=t(a);function l(t){return void 0===t}const p=t(l);function x(t){return a(t)||l(t)}const h=t(x);function N(t,n){return Object.prototype.hasOwnProperty.call(t,n)}function g(t){return"function"==typeof t}function v(t,...n){return g(t)?t(...n):t}var b=Object.assign;function d(t,n){if(!t)throw n instanceof String?n.valueOf():new Error(n?v(n):n)}var y=Object.freeze({__proto__:null,createBus:function(){const t={};return{emit(t,r){n(t).concat(n("*")).forEach((t=>{t(r)}))},on:(r,e)=>(t[r]=n(r).concat(e),{off(){t[r]=n(r).filter((t=>t!==e))}})};function n(n){return t[n]||[]}}});const m=E();function E(t){return n=0,()=>`${t?t+"_":""}${n++}`;var n}function S(t){return"object"==typeof t&&!x(t)}function O(t){return Boolean(Array.isArray(t))}const _=t(O);function j(t){return!t||(N(t,"length")?i(t,0):!!S(t)&&i(Object.keys(t),0))}const w=t(j);const A=/{(.*?)}/g;var T=Object.freeze({__proto__:null,createTinyState:function(t){let n;return e(),()=>[n,r,e];function r(t){n=v(t,n)}function e(){r(v(t))}}});exports.StateMachine=function(t){let n=t.initial;return{getState:function(){return n},transition:function(t,e){return n=r(n,t,e)},staticTransition:r};function r(n,r,e){var o,i,u;let s=null!==(i=null===(o=t.states[n])||void 0===o?void 0:o[r])&&void 0!==i?i:null===(u=t.states["*"])||void 0===u?void 0:u[r];if(Array.isArray(s)){const[,t]=s;if(!t(e))return n;s=s[0]}return s&&s!==n?s:n}},exports.StringObject=function(t){return new String(v(t))},exports.asArray=function(t){return[].concat(t)},exports.assign=b,exports.bindNot=t,exports.bus=y,exports.cache=function(t=1){const n=[],r=(e,o)=>{const i=r.get(e);if(i)return i[1];const u=o();return n.unshift([e.concat(),u]),c(n,t)&&(n.length=t),u};return r.invalidate=t=>{const r=e(t);r>-1&&n.splice(r,1)},r.get=t=>n[e(t)]||null,r;function e(t){return n.findIndex((([n])=>i(t,n.length)&&t.every(((t,r)=>t===n[r]))))}},exports.callEach=function(t){return t.forEach((t=>t()))},exports.defaultTo=function(t,n){var r;return null!==(r=v(t))&&void 0!==r?r:v(n)},exports.deferThrow=function(t){setTimeout((()=>{throw new Error(t)}),0)},exports.either=function(t,n){return!!t!=!!n},exports.genSeq=E,exports.greaterThan=s,exports.hasOwnProperty=N,exports.invariant=d,exports.isArray=O,exports.isBoolean=function(t){return!!t===t},exports.isEmpty=j,exports.isFunction=g,exports.isNotArray=_,exports.isNotEmpty=w,exports.isNotNull=f,exports.isNotNullish=h,exports.isNotNumeric=r,exports.isNotUndefined=p,exports.isNull=a,exports.isNullish=x,exports.isNumeric=n,exports.isObject=S,exports.isPositive=function(t){return s(t,0)},exports.isPromise=function(t){return!!t&&g(t.then)},exports.isStringValue=function(t){return String(t)===t},exports.isUndefined=l,exports.lengthEquals=i,exports.lengthNotEquals=u,exports.longerThan=c,exports.mapFirst=function(t,n){let r=!1,e=null;for(let i=0;i<t.length;i++)if(n(t[i],o,i),r)return e;function o(t,n){t&&(r=!0,e=n)}},exports.nonnullish=function(t,n){return d(!x(t),n),t},exports.noop=function(){},exports.numberEquals=e,exports.numberNotEquals=o,exports.optionalFunctionValue=v,exports.seq=m,exports.text=function(t,...n){const r=n[0];if(S(r))return t.replace(A,((t,n)=>{var e;return`${null!==(e=r[n])&&void 0!==e?e:t}`}));const e=[...n];return t.replace(A,(t=>`${j(e)?t:e.shift()}`))},exports.tinyState=T;
"use strict";function t(t){return(...n)=>!t(...n)}function n(t){const n=String(t),r=Number(t),e=!isNaN(parseFloat(n))&&!isNaN(Number(t))&&isFinite(r);return Boolean(e)}const r=t(n);function e(t,r){return n(t)&&n(r)&&Number(t)===Number(r)}const o=t(e);function i(t,n){return e(t.length,n)}const u=t(i);function s(t,r){return n(t)&&n(r)&&Number(t)>Number(r)}function c(t,n){return s(t.length,n)}function a(t){return null===t}const f=t(a);function l(t){return void 0===t}const p=t(l);function x(t){return a(t)||l(t)}const h=t(x);function N(t,n){return Object.prototype.hasOwnProperty.call(t,n)}function g(t){return"function"==typeof t}function v(t,...n){return g(t)?t(...n):t}var y=Object.assign;function b(t,n){if(!t)throw n instanceof String?n.valueOf():new Error(n?v(n):n)}var d=Object.freeze({__proto__:null,createBus:function(){const t={};return{emit(t,r){n(t).concat(n("*")).forEach((t=>{t(r)}))},on:(r,e)=>(t[r]=n(r).concat(e),{off(){t[r]=n(r).filter((t=>t!==e))}})};function n(n){return t[n]||[]}}});const m=_();function _(t){return n=0,()=>`${t?t+"_":""}${n++}`;var n}function E(t){return"object"==typeof t&&!x(t)}function O(t){return Boolean(Array.isArray(t))}const S=t(O);function j(t){return!t||(N(t,"length")?i(t,0):!!E(t)&&i(Object.keys(t),0))}const w=t(j);const A=/{(.*?)}/g;var T=Object.freeze({__proto__:null,createTinyState:function(t){let n;return e(),()=>[n,r,e];function r(t){n=v(t,n)}function e(){r(v(t))}}});var q=Object.freeze({__proto__:null,all:function(...t){return n=>!j(t)&&t.every((t=>v(t,n)))},any:function(...t){return n=>!j(t)&&t.some((t=>v(t,n)))}});exports.Predicates=q,exports.StateMachine=function(t){let n=t.initial;return{getState:function(){return n},initial:function(){return t.initial},staticTransition:r,transition:function(t,e){return n=r(n,t,e)}};function r(n,r,e){var o,i,u;let s=null!==(i=null===(o=t.states[n])||void 0===o?void 0:o[r])&&void 0!==i?i:null===(u=t.states["*"])||void 0===u?void 0:u[r];if(Array.isArray(s)){const[,t]=s;if(!t(e))return n;s=s[0]}return s&&s!==n?s:n}},exports.StringObject=function(t){return new String(v(t))},exports.asArray=function(t){return[].concat(t)},exports.assign=y,exports.bindNot=t,exports.bus=d,exports.cache=function(t=1){const n=[],r=(e,o)=>{const i=r.get(e);if(i)return i[1];const u=o();return n.unshift([e.concat(),u]),c(n,t)&&(n.length=t),u};return r.invalidate=t=>{const r=e(t);r>-1&&n.splice(r,1)},r.get=t=>n[e(t)]||null,r;function e(t){return n.findIndex((([n])=>i(t,n.length)&&t.every(((t,r)=>t===n[r]))))}},exports.callEach=function(t){return t.forEach((t=>t()))},exports.defaultTo=function(t,n){var r;return null!==(r=v(t))&&void 0!==r?r:v(n)},exports.deferThrow=function(t){setTimeout((()=>{throw new Error(t)}),0)},exports.either=function(t,n){return!!t!=!!n},exports.genSeq=_,exports.greaterThan=s,exports.hasOwnProperty=N,exports.invariant=b,exports.isArray=O,exports.isBoolean=function(t){return!!t===t},exports.isEmpty=j,exports.isFunction=g,exports.isNotArray=S,exports.isNotEmpty=w,exports.isNotNull=f,exports.isNotNullish=h,exports.isNotNumeric=r,exports.isNotUndefined=p,exports.isNull=a,exports.isNullish=x,exports.isNumeric=n,exports.isObject=E,exports.isPositive=function(t){return s(t,0)},exports.isPromise=function(t){return!!t&&g(t.then)},exports.isStringValue=function(t){return String(t)===t},exports.isUndefined=l,exports.lengthEquals=i,exports.lengthNotEquals=u,exports.longerThan=c,exports.mapFirst=function(t,n){let r=!1,e=null;for(let i=0;i<t.length;i++)if(n(t[i],o,i),r)return e;function o(t,n){t&&(r=!0,e=n)}},exports.nonnullish=function(t,n){return b(!x(t),n),t},exports.noop=function(){},exports.numberEquals=e,exports.numberNotEquals=o,exports.optionalFunctionValue=v,exports.seq=m,exports.text=function(t,...n){const r=n[0];if(E(r))return t.replace(A,((t,n)=>{var e;return`${null!==(e=r[n])&&void 0!==e?e:t}`}));const e=[...n];return t.replace(A,(t=>`${j(e)?t:e.shift()}`))},exports.tinyState=T;
//# sourceMappingURL=vest-utils.production.js.map

@@ -246,3 +246,3 @@ function bindNot(fn) {

let state = machine.initial;
const api = { getState, transition, staticTransition };
const api = { getState, initial, staticTransition, transition };
return api;

@@ -252,2 +252,5 @@ function getState() {

}
function initial() {
return machine.initial;
}
function transition(action, payload) {

@@ -307,3 +310,20 @@ return (state = staticTransition(state, action, payload));

export { StateMachine, StringObject, asArray, assign, bindNot, bus, createCache as cache, callEach, defaultTo, deferThrow, either, genSeq, greaterThan, hasOwnProperty, invariant, isArray, isBoolean, isEmpty, isFunction, isNotArray, isNotEmpty, isNotNull, isNotNullish, isNotNumeric, isNotUndefined, isNull, isNullish, isNumeric, isObject, isPositive, isPromise, isStringValue, isUndefined, lengthEquals, lengthNotEquals, longerThan, mapFirst, nonnullish, noop, numberEquals, numberNotEquals, optionalFunctionValue, seq, text, tinyState };
function all(...p) {
return (value) => isEmpty(p)
? false
: p.every(predicate => optionalFunctionValue(predicate, value));
}
function any(...p) {
return (value) => isEmpty(p)
? false
: p.some(predicate => optionalFunctionValue(predicate, value));
}
var Predicates = /*#__PURE__*/Object.freeze({
__proto__: null,
all: all,
any: any
});
export { Predicates, StateMachine, StringObject, asArray, assign, bindNot, bus, createCache as cache, callEach, defaultTo, deferThrow, either, genSeq, greaterThan, hasOwnProperty, invariant, isArray, isBoolean, isEmpty, isFunction, isNotArray, isNotEmpty, isNotNull, isNotNullish, isNotNumeric, isNotUndefined, isNull, isNullish, isNumeric, isObject, isPositive, isPromise, isStringValue, isUndefined, lengthEquals, lengthNotEquals, longerThan, mapFirst, nonnullish, noop, numberEquals, numberNotEquals, optionalFunctionValue, seq, text, tinyState };
//# sourceMappingURL=vest-utils.development.js.map

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

function n(n){return(...t)=>!n(...t)}function t(n){const t=String(n),r=Number(n),e=!isNaN(parseFloat(t))&&!isNaN(Number(n))&&isFinite(r);return Boolean(e)}const r=n(t);function e(n,r){return t(n)&&t(r)&&Number(n)===Number(r)}const u=n(e);function o(n,t){return e(n.length,t)}const c=n(o);function i(n,r){return t(n)&&t(r)&&Number(n)>Number(r)}function f(n,t){return i(n.length,t)}function a(n=1){const t=[],r=(e,u)=>{const o=r.get(e);if(o)return o[1];const c=u();return t.unshift([e.concat(),c]),f(t,n)&&(t.length=n),c};return r.invalidate=n=>{const r=e(n);r>-1&&t.splice(r,1)},r.get=n=>t[e(n)]||null,r;function e(n){return t.findIndex((([t])=>o(n,t.length)&&n.every(((n,r)=>n===t[r]))))}}function l(n){return null===n}const s=n(l);function v(n){return void 0===n}const g=n(v);function h(n){return l(n)||v(n)}const b=n(h);function p(n){return[].concat(n)}function d(n){return n.forEach((n=>n()))}function y(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function N(n){return"function"==typeof n}function _(n){return!!n&&N(n.then)}function m(n,...t){return N(n)?n(...t):n}var O=Object.assign;function j(n,t){var r;return null!==(r=m(n))&&void 0!==r?r:m(t)}function w(n,t){if(!n)throw t instanceof String?t.valueOf():new Error(t?m(t):t)}function S(n){return String(n)===n}function A(n,t){return!!n!=!!t}function E(n){return!!n===n}function $(n){setTimeout((()=>{throw new Error(n)}),0)}var B=Object.freeze({__proto__:null,createBus:function(){const n={};return{emit(n,r){t(n).concat(t("*")).forEach((n=>{n(r)}))},on:(r,e)=>(n[r]=t(r).concat(e),{off(){n[r]=t(r).filter((n=>n!==e))}})};function t(t){return n[t]||[]}}});const T=x();function x(n){return t=0,()=>`${n?n+"_":""}${t++}`;var t}function z(n,t){let r=!1,e=null;for(let o=0;o<n.length;o++)if(t(n[o],u,o),r)return e;function u(n,t){n&&(r=!0,e=t)}}function F(n){return"object"==typeof n&&!h(n)}function k(n){return Boolean(Array.isArray(n))}const I=n(k);function P(n){return!n||(y(n,"length")?o(n,0):!!F(n)&&o(Object.keys(n),0))}const q=n(P);function C(n){return i(n,0)}const D=/{(.*?)}/g;function G(n,...t){const r=t[0];if(F(r))return n.replace(D,((n,t)=>{var e;return`${null!==(e=r[t])&&void 0!==e?e:n}`}));const e=[...t];return n.replace(D,(n=>`${P(e)?n:e.shift()}`))}function H(n){let t=n.initial;return{getState:function(){return t},transition:function(n,e){return t=r(t,n,e)},staticTransition:r};function r(t,r,e){var u,o,c;let i=null!==(o=null===(u=n.states[t])||void 0===u?void 0:u[r])&&void 0!==o?o:null===(c=n.states["*"])||void 0===c?void 0:c[r];if(Array.isArray(i)){const[,n]=i;if(!n(e))return t;i=i[0]}return i&&i!==t?i:t}}function J(n,t){return w(!h(n),t),n}var K=Object.freeze({__proto__:null,createTinyState:function(n){let t;return e(),()=>[t,r,e];function r(n){t=m(n,t)}function e(){r(m(n))}}});function L(n){return new String(m(n))}function M(){}export{H as StateMachine,L as StringObject,p as asArray,O as assign,n as bindNot,B as bus,a as cache,d as callEach,j as defaultTo,$ as deferThrow,A as either,x as genSeq,i as greaterThan,y as hasOwnProperty,w as invariant,k as isArray,E as isBoolean,P as isEmpty,N as isFunction,I as isNotArray,q as isNotEmpty,s as isNotNull,b as isNotNullish,r as isNotNumeric,g as isNotUndefined,l as isNull,h as isNullish,t as isNumeric,F as isObject,C as isPositive,_ as isPromise,S as isStringValue,v as isUndefined,o as lengthEquals,c as lengthNotEquals,f as longerThan,z as mapFirst,J as nonnullish,M as noop,e as numberEquals,u as numberNotEquals,m as optionalFunctionValue,T as seq,G as text,K as tinyState};
function n(n){return(...t)=>!n(...t)}function t(n){const t=String(n),r=Number(n),e=!isNaN(parseFloat(t))&&!isNaN(Number(n))&&isFinite(r);return Boolean(e)}const r=n(t);function e(n,r){return t(n)&&t(r)&&Number(n)===Number(r)}const u=n(e);function o(n,t){return e(n.length,t)}const i=n(o);function c(n,r){return t(n)&&t(r)&&Number(n)>Number(r)}function f(n,t){return c(n.length,t)}function a(n=1){const t=[],r=(e,u)=>{const o=r.get(e);if(o)return o[1];const i=u();return t.unshift([e.concat(),i]),f(t,n)&&(t.length=n),i};return r.invalidate=n=>{const r=e(n);r>-1&&t.splice(r,1)},r.get=n=>t[e(n)]||null,r;function e(n){return t.findIndex((([t])=>o(n,t.length)&&n.every(((n,r)=>n===t[r]))))}}function l(n){return null===n}const s=n(l);function v(n){return void 0===n}const g=n(v);function h(n){return l(n)||v(n)}const b=n(h);function p(n){return[].concat(n)}function y(n){return n.forEach((n=>n()))}function _(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function d(n){return"function"==typeof n}function N(n){return!!n&&d(n.then)}function m(n,...t){return d(n)?n(...t):n}var O=Object.assign;function j(n,t){var r;return null!==(r=m(n))&&void 0!==r?r:m(t)}function w(n,t){if(!n)throw t instanceof String?t.valueOf():new Error(t?m(t):t)}function S(n){return String(n)===n}function A(n,t){return!!n!=!!t}function E(n){return!!n===n}function $(n){setTimeout((()=>{throw new Error(n)}),0)}var z=Object.freeze({__proto__:null,createBus:function(){const n={};return{emit(n,r){t(n).concat(t("*")).forEach((n=>{n(r)}))},on:(r,e)=>(n[r]=t(r).concat(e),{off(){n[r]=t(r).filter((n=>n!==e))}})};function t(t){return n[t]||[]}}});const B=T();function T(n){return t=0,()=>`${n?n+"_":""}${t++}`;var t}function x(n,t){let r=!1,e=null;for(let o=0;o<n.length;o++)if(t(n[o],u,o),r)return e;function u(n,t){n&&(r=!0,e=t)}}function F(n){return"object"==typeof n&&!h(n)}function k(n){return Boolean(Array.isArray(n))}const I=n(k);function P(n){return!n||(_(n,"length")?o(n,0):!!F(n)&&o(Object.keys(n),0))}const q=n(P);function C(n){return c(n,0)}const D=/{(.*?)}/g;function G(n,...t){const r=t[0];if(F(r))return n.replace(D,((n,t)=>{var e;return`${null!==(e=r[t])&&void 0!==e?e:n}`}));const e=[...t];return n.replace(D,(n=>`${P(e)?n:e.shift()}`))}function H(n){let t=n.initial;return{getState:function(){return t},initial:function(){return n.initial},staticTransition:r,transition:function(n,e){return t=r(t,n,e)}};function r(t,r,e){var u,o,i;let c=null!==(o=null===(u=n.states[t])||void 0===u?void 0:u[r])&&void 0!==o?o:null===(i=n.states["*"])||void 0===i?void 0:i[r];if(Array.isArray(c)){const[,n]=c;if(!n(e))return t;c=c[0]}return c&&c!==t?c:t}}function J(n,t){return w(!h(n),t),n}var K=Object.freeze({__proto__:null,createTinyState:function(n){let t;return e(),()=>[t,r,e];function r(n){t=m(n,t)}function e(){r(m(n))}}});function L(n){return new String(m(n))}function M(){}var Q=Object.freeze({__proto__:null,all:function(...n){return t=>!P(n)&&n.every((n=>m(n,t)))},any:function(...n){return t=>!P(n)&&n.some((n=>m(n,t)))}});export{Q as Predicates,H as StateMachine,L as StringObject,p as asArray,O as assign,n as bindNot,z as bus,a as cache,y as callEach,j as defaultTo,$ as deferThrow,A as either,T as genSeq,c as greaterThan,_ as hasOwnProperty,w as invariant,k as isArray,E as isBoolean,P as isEmpty,d as isFunction,I as isNotArray,q as isNotEmpty,s as isNotNull,b as isNotNullish,r as isNotNumeric,g as isNotUndefined,l as isNull,h as isNullish,t as isNumeric,F as isObject,C as isPositive,N as isPromise,S as isStringValue,v as isUndefined,o as lengthEquals,i as lengthNotEquals,f as longerThan,x as mapFirst,J as nonnullish,M as noop,e as numberEquals,u as numberNotEquals,m as optionalFunctionValue,B as seq,G as text,K as tinyState};
//# sourceMappingURL=vest-utils.production.js.map

@@ -252,3 +252,3 @@ (function (global, factory) {

let state = machine.initial;
const api = { getState, transition, staticTransition };
const api = { getState, initial, staticTransition, transition };
return api;

@@ -258,2 +258,5 @@ function getState() {

}
function initial() {
return machine.initial;
}
function transition(action, payload) {

@@ -313,2 +316,20 @@ return (state = staticTransition(state, action, payload));

function all(...p) {
return (value) => isEmpty(p)
? false
: p.every(predicate => optionalFunctionValue(predicate, value));
}
function any(...p) {
return (value) => isEmpty(p)
? false
: p.some(predicate => optionalFunctionValue(predicate, value));
}
var Predicates = /*#__PURE__*/Object.freeze({
__proto__: null,
all: all,
any: any
});
exports.Predicates = Predicates;
exports.StateMachine = StateMachine;

@@ -315,0 +336,0 @@ exports.StringObject = StringObject;

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

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self)["vest-utils"]={})}(this,(function(n){"use strict";function t(n){return(...t)=>!n(...t)}function e(n){const t=String(n),e=Number(n),r=!isNaN(parseFloat(t))&&!isNaN(Number(n))&&isFinite(e);return Boolean(r)}const r=t(e);function i(n,t){return e(n)&&e(t)&&Number(n)===Number(t)}const o=t(i);function u(n,t){return i(n.length,t)}const c=t(u);function s(n,t){return e(n)&&e(t)&&Number(n)>Number(t)}function f(n,t){return s(n.length,t)}function l(n){return null===n}const a=t(l);function h(n){return void 0===n}const d=t(h);function g(n){return l(n)||h(n)}const N=t(g);function p(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function y(n){return"function"==typeof n}function b(n,...t){return y(n)?n(...t):n}var v=Object.assign;function m(n,t){if(!n)throw t instanceof String?t.valueOf():new Error(t?b(t):t)}var E=Object.freeze({__proto__:null,createBus:function(){const n={};return{emit(n,e){t(n).concat(t("*")).forEach((n=>{n(e)}))},on:(e,r)=>(n[e]=t(e).concat(r),{off(){n[e]=t(e).filter((n=>n!==r))}})};function t(t){return n[t]||[]}}});const S=O();function O(n){return t=0,()=>`${n?n+"_":""}${t++}`;var t}function j(n){return"object"==typeof n&&!g(n)}function T(n){return Boolean(Array.isArray(n))}const _=t(T);function w(n){return!n||(p(n,"length")?u(n,0):!!j(n)&&u(Object.keys(n),0))}const A=t(w);const q=/{(.*?)}/g;var x=Object.freeze({__proto__:null,createTinyState:function(n){let t;return r(),()=>[t,e,r];function e(n){t=b(n,t)}function r(){e(b(n))}}});n.StateMachine=function(n){let t=n.initial;return{getState:function(){return t},transition:function(n,r){return t=e(t,n,r)},staticTransition:e};function e(t,e,r){var i,o,u;let c=null!==(o=null===(i=n.states[t])||void 0===i?void 0:i[e])&&void 0!==o?o:null===(u=n.states["*"])||void 0===u?void 0:u[e];if(Array.isArray(c)){const[,n]=c;if(!n(r))return t;c=c[0]}return c&&c!==t?c:t}},n.StringObject=function(n){return new String(b(n))},n.asArray=function(n){return[].concat(n)},n.assign=v,n.bindNot=t,n.bus=E,n.cache=function(n=1){const t=[],e=(r,i)=>{const o=e.get(r);if(o)return o[1];const u=i();return t.unshift([r.concat(),u]),f(t,n)&&(t.length=n),u};return e.invalidate=n=>{const e=r(n);e>-1&&t.splice(e,1)},e.get=n=>t[r(n)]||null,e;function r(n){return t.findIndex((([t])=>u(n,t.length)&&n.every(((n,e)=>n===t[e]))))}},n.callEach=function(n){return n.forEach((n=>n()))},n.defaultTo=function(n,t){var e;return null!==(e=b(n))&&void 0!==e?e:b(t)},n.deferThrow=function(n){setTimeout((()=>{throw new Error(n)}),0)},n.either=function(n,t){return!!n!=!!t},n.genSeq=O,n.greaterThan=s,n.hasOwnProperty=p,n.invariant=m,n.isArray=T,n.isBoolean=function(n){return!!n===n},n.isEmpty=w,n.isFunction=y,n.isNotArray=_,n.isNotEmpty=A,n.isNotNull=a,n.isNotNullish=N,n.isNotNumeric=r,n.isNotUndefined=d,n.isNull=l,n.isNullish=g,n.isNumeric=e,n.isObject=j,n.isPositive=function(n){return s(n,0)},n.isPromise=function(n){return!!n&&y(n.then)},n.isStringValue=function(n){return String(n)===n},n.isUndefined=h,n.lengthEquals=u,n.lengthNotEquals=c,n.longerThan=f,n.mapFirst=function(n,t){let e=!1,r=null;for(let o=0;o<n.length;o++)if(t(n[o],i,o),e)return r;function i(n,t){n&&(e=!0,r=t)}},n.nonnullish=function(n,t){return m(!g(n),t),n},n.noop=function(){},n.numberEquals=i,n.numberNotEquals=o,n.optionalFunctionValue=b,n.seq=S,n.text=function(n,...t){const e=t[0];if(j(e))return n.replace(q,((n,t)=>{var r;return`${null!==(r=e[t])&&void 0!==r?r:n}`}));const r=[...t];return n.replace(q,(n=>`${w(r)?n:r.shift()}`))},n.tinyState=x}));
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self)["vest-utils"]={})}(this,(function(n){"use strict";function t(n){return(...t)=>!n(...t)}function e(n){const t=String(n),e=Number(n),r=!isNaN(parseFloat(t))&&!isNaN(Number(n))&&isFinite(e);return Boolean(r)}const r=t(e);function i(n,t){return e(n)&&e(t)&&Number(n)===Number(t)}const o=t(i);function u(n,t){return i(n.length,t)}const c=t(u);function s(n,t){return e(n)&&e(t)&&Number(n)>Number(t)}function f(n,t){return s(n.length,t)}function l(n){return null===n}const a=t(l);function h(n){return void 0===n}const d=t(h);function g(n){return l(n)||h(n)}const p=t(g);function N(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function y(n){return"function"==typeof n}function v(n,...t){return y(n)?n(...t):n}var b=Object.assign;function m(n,t){if(!n)throw t instanceof String?t.valueOf():new Error(t?v(t):t)}var _=Object.freeze({__proto__:null,createBus:function(){const n={};return{emit(n,e){t(n).concat(t("*")).forEach((n=>{n(e)}))},on:(e,r)=>(n[e]=t(e).concat(r),{off(){n[e]=t(e).filter((n=>n!==r))}})};function t(t){return n[t]||[]}}});const E=O();function O(n){return t=0,()=>`${n?n+"_":""}${t++}`;var t}function S(n){return"object"==typeof n&&!g(n)}function j(n){return Boolean(Array.isArray(n))}const T=t(j);function w(n){return!n||(N(n,"length")?u(n,0):!!S(n)&&u(Object.keys(n),0))}const A=t(w);const q=/{(.*?)}/g;var x=Object.freeze({__proto__:null,createTinyState:function(n){let t;return r(),()=>[t,e,r];function e(n){t=v(n,t)}function r(){e(v(n))}}});var F=Object.freeze({__proto__:null,all:function(...n){return t=>!w(n)&&n.every((n=>v(n,t)))},any:function(...n){return t=>!w(n)&&n.some((n=>v(n,t)))}});n.Predicates=F,n.StateMachine=function(n){let t=n.initial;return{getState:function(){return t},initial:function(){return n.initial},staticTransition:e,transition:function(n,r){return t=e(t,n,r)}};function e(t,e,r){var i,o,u;let c=null!==(o=null===(i=n.states[t])||void 0===i?void 0:i[e])&&void 0!==o?o:null===(u=n.states["*"])||void 0===u?void 0:u[e];if(Array.isArray(c)){const[,n]=c;if(!n(r))return t;c=c[0]}return c&&c!==t?c:t}},n.StringObject=function(n){return new String(v(n))},n.asArray=function(n){return[].concat(n)},n.assign=b,n.bindNot=t,n.bus=_,n.cache=function(n=1){const t=[],e=(r,i)=>{const o=e.get(r);if(o)return o[1];const u=i();return t.unshift([r.concat(),u]),f(t,n)&&(t.length=n),u};return e.invalidate=n=>{const e=r(n);e>-1&&t.splice(e,1)},e.get=n=>t[r(n)]||null,e;function r(n){return t.findIndex((([t])=>u(n,t.length)&&n.every(((n,e)=>n===t[e]))))}},n.callEach=function(n){return n.forEach((n=>n()))},n.defaultTo=function(n,t){var e;return null!==(e=v(n))&&void 0!==e?e:v(t)},n.deferThrow=function(n){setTimeout((()=>{throw new Error(n)}),0)},n.either=function(n,t){return!!n!=!!t},n.genSeq=O,n.greaterThan=s,n.hasOwnProperty=N,n.invariant=m,n.isArray=j,n.isBoolean=function(n){return!!n===n},n.isEmpty=w,n.isFunction=y,n.isNotArray=T,n.isNotEmpty=A,n.isNotNull=a,n.isNotNullish=p,n.isNotNumeric=r,n.isNotUndefined=d,n.isNull=l,n.isNullish=g,n.isNumeric=e,n.isObject=S,n.isPositive=function(n){return s(n,0)},n.isPromise=function(n){return!!n&&y(n.then)},n.isStringValue=function(n){return String(n)===n},n.isUndefined=h,n.lengthEquals=u,n.lengthNotEquals=c,n.longerThan=f,n.mapFirst=function(n,t){let e=!1,r=null;for(let o=0;o<n.length;o++)if(t(n[o],i,o),e)return r;function i(n,t){n&&(e=!0,r=t)}},n.nonnullish=function(n,t){return m(!g(n),t),n},n.noop=function(){},n.numberEquals=i,n.numberNotEquals=o,n.optionalFunctionValue=v,n.seq=E,n.text=function(n,...t){const e=t[0];if(S(e))return n.replace(q,((n,t)=>{var r;return`${null!==(r=e[t])&&void 0!==r?r:n}`}));const r=[...t];return n.replace(q,(n=>`${w(r)?n:r.shift()}`))},n.tinyState=x}));
//# sourceMappingURL=vest-utils.production.js.map
{
"version": "1.1.2",
"version": "1.2.0",
"name": "vest-utils",

@@ -4,0 +4,0 @@ "author": "ealush",

@@ -119,3 +119,3 @@ type DropFirst<T extends unknown[]> = T extends [

type TStateWildCard = typeof STATE_WILD_CARD;
type TStateMachine<S extends string, A extends string> = {
type TStateMachine<S extends string, A extends S = S> = {
initial: S;

@@ -133,8 +133,9 @@ states: Partial<{

};
type TStateMachineApi<S extends string, A extends string> = {
type TStateMachineApi<S extends string, A extends S = S> = {
getState: CB<S>;
initial: CB<S>;
staticTransition: (from: S, action: A, payload?: any) => S;
transition: (action: A, payload?: any) => void;
staticTransition: (from: S, action: A, payload?: any) => S;
};
declare function StateMachine<S extends string, A extends string>(machine: TStateMachine<S, A>): TStateMachineApi<S, A>;
declare function StateMachine<S extends string, A extends S = S>(machine: TStateMachine<S, A>): TStateMachineApi<S, A>;
declare function nonnullish<T>(value: Nullish<T>, error?: string): T;

@@ -170,4 +171,9 @@ declare namespace tinyState {

declare function noop(): void;
export { createCache as cache, CacheApi, BusType, TinyState, isNullish, isNotNullish, asArray, callEach, hasOwnProperty, isPromise, optionalFunctionValue, _default as assign, defaultTo, invariant, isStringValue, bindNot, either, isBoolean, deferThrow, bus, seq, genSeq, isFunction, mapFirst, greaterThan, longerThan, isNumeric, isNotNumeric, isObject, lengthEquals, lengthNotEquals, numberEquals, numberNotEquals, isNull, isNotNull, isUndefined, isNotUndefined, isArray, isNotArray, isEmpty, isNotEmpty, isPositive, text, TStateMachine, StateMachine, nonnullish, tinyState, StringObject, noop };
export type { DropFirst, Stringable, CB, ValueOf, Nullish, Nullable, Maybe, OneOrMoreOf, DynamicValue, BlankValue };
declare namespace Predicates {
type Predicate<T> = boolean | ((value: T) => boolean);
function all<T = any>(...p: Predicate<T>[]): (value: T) => boolean;
function any<T = any>(...p: Predicate<T>[]): (value: T) => boolean;
}
export { createCache as cache, CacheApi, BusType, TinyState, isNullish, isNotNullish, asArray, callEach, hasOwnProperty, isPromise, optionalFunctionValue, _default as assign, defaultTo, invariant, isStringValue, bindNot, either, isBoolean, deferThrow, bus, seq, genSeq, isFunction, mapFirst, greaterThan, longerThan, isNumeric, isNotNumeric, isObject, lengthEquals, lengthNotEquals, numberEquals, numberNotEquals, isNull, isNotNull, isUndefined, isNotUndefined, isArray, isNotArray, isEmpty, isNotEmpty, isPositive, text, TStateMachine, StateMachine, nonnullish, tinyState, StringObject, noop, Predicates };
export type { Predicate, DropFirst, Stringable, CB, ValueOf, Nullish, Nullable, Maybe, OneOrMoreOf, DynamicValue, BlankValue };
//# sourceMappingURL=vest-utils.d.ts.map

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