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

vest-utils

Package Overview
Dependencies
Maintainers
1
Versions
101
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 0.0.1-rc to 0.0.2-dev-9b46fb

LICENSE

340

dist/cjs/vest-utils.development.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function bindNot(fn) {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return !fn.apply(void 0, args);
};
}
function isNumeric(value) {
var str = String(value);
var num = Number(value);
var result = !isNaN(parseFloat(str)) && !isNaN(Number(value)) && isFinite(num);
return Boolean(result);
}
var isNotNumeric = bindNot(isNumeric);
function numberEquals(value, eq) {
return isNumeric(value) && isNumeric(eq) && Number(value) === Number(eq);
}
var numberNotEquals = bindNot(numberEquals);
function lengthEquals(value, arg1) {
return numberEquals(value.length, arg1);
}
var lengthNotEquals = bindNot(lengthEquals);
function greaterThan(value, gt) {
return isNumeric(value) && isNumeric(gt) && Number(value) > Number(gt);
}
function longerThan(value, arg1) {
return greaterThan(value.length, arg1);
}
/**
* Creates a cache function
*/
function createCache(maxSize) {
if (maxSize === void 0) { maxSize = 1; }
var cacheStorage = [];
var cache = function (deps, cacheAction) {
var cacheHit = cache.get(deps);
// cache hit is not null
if (cacheHit)
return cacheHit[1];
var result = cacheAction();
cacheStorage.unshift([deps.concat(), result]);
if (longerThan(cacheStorage, maxSize))
cacheStorage.length = maxSize;
return result;
};
// invalidate an item in the cache by its dependencies
cache.invalidate = function (deps) {
var index = findIndex(deps);
if (index > -1)
cacheStorage.splice(index, 1);
};
// Retrieves an item from the cache.
cache.get = function (deps) {
return cacheStorage[findIndex(deps)] || null;
};
return cache;
function findIndex(deps) {
return cacheStorage.findIndex(function (_a) {
var cachedDeps = _a[0];
return lengthEquals(deps, cachedDeps.length) &&
deps.every(function (dep, i) { return dep === cachedDeps[i]; });
});
}
}
function isNull(value) {
return value === null;
}
var isNotNull = bindNot(isNull);
function isUndefined(value) {
return value === undefined;
}
var isNotUndefined = bindNot(isUndefined);
function isNullish(value) {
return isNull(value) || isUndefined(value);
}
var isNotNullish = bindNot(isNullish);
function asArray(possibleArg) {
return [].concat(possibleArg);
}
function isFunction(value) {
return typeof value === 'function';
}
function optionalFunctionValue(value) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return isFunction(value) ? value.apply(void 0, args) : value;
}
function defaultTo(value, defaultValue) {
var _a;
return (_a = optionalFunctionValue(value)) !== null && _a !== void 0 ? _a : optionalFunctionValue(defaultValue);
}
// The module is named "isArrayValue" since it
// is conflicting with a nested npm dependency.
// We may need to revisit this in the future.
function isArray(value) {
return Boolean(Array.isArray(value));
}
var isNotArray = bindNot(isArray);
function last(values) {
var valuesArray = asArray(values);
return valuesArray[valuesArray.length - 1];
}
// This is kind of a map/filter in one function.
// Normally, behaves like a nested-array map,
// but returning `null` will drop the element from the array
function transform(array, cb) {
var res = [];
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
var v = array_1[_i];
if (isArray(v)) {
res.push(transform(v, cb));
}
else {
var output = cb(v);
if (isNotNull(output)) {
res.push(output);
}
}
}
return res;
}
function valueAtPath(array, path) {
return getCurrent(array, path)[last(path)];
}
function setValueAtPath(array, path, value) {
var current = getCurrent(array, path);
current[last(path)] = value;
return array;
}
function flatten(values) {
return asArray(values).reduce(function (acc, value) {
if (isArray(value)) {
return acc.concat(flatten(value));
}
return asArray(acc).concat(value);
}, []);
}
function getCurrent(array, path) {
var current = array;
for (var _i = 0, _a = path.slice(0, -1); _i < _a.length; _i++) {
var p = _a[_i];
current[p] = defaultTo(current[p], []);
current = current[p];
}
return current;
}
var nestedArray = /*#__PURE__*/Object.freeze({
__proto__: null,
transform: transform,
valueAtPath: valueAtPath,
setValueAtPath: setValueAtPath,
flatten: flatten,
getCurrent: getCurrent
});
function callEach(arr) {
return arr.forEach(function (fn) { return fn(); });
}
/**
* A safe hasOwnProperty access
*/
function hasOwnProperty(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isPromise(value) {
return value && isFunction(value.then);
}
var assign = Object.assign;
function invariant(condition,
// eslint-disable-next-line @typescript-eslint/ban-types
message) {
if (condition) {
return;
}
// If message is a string object (rather than string literal)
// Throw the value directly as a string
// Alternatively, throw an error with the message
throw message instanceof String
? message.valueOf()
: new Error(message ? optionalFunctionValue(message) : message);
}
// eslint-disable-next-line @typescript-eslint/ban-types
function StringObject(value) {
return new String(optionalFunctionValue(value));
}
function isStringValue(v) {
return String(v) === v;
}
function either(a, b) {
return !!a !== !!b;
}
function isBoolean(value) {
return !!value === value;
}
function deferThrow(message) {
setTimeout(function () {
throw new Error(message);
}, 0);
}
function createBus() {
var listeners = {};
return {
emit: function (event, data) {
listener(event).forEach(function (handler) {
handler(data);
});
},
on: function (event, handler) {
listeners[event] = listener(event).concat(handler);
return {
off: function () {
listeners[event] = listener(event).filter(function (h) { return h !== handler; });
}
};
}
};
function listener(event) {
return listeners[event] || [];
}
}
var bus = /*#__PURE__*/Object.freeze({
__proto__: null,
createBus: createBus
});
/**
* @returns a unique numeric id.
*/
var seq = (function (n) { return function () {
return "".concat(n++);
}; })(0);
function mapFirst(array, callback) {
var broke = false;
var breakoutValue = null;
for (var i = 0; i < array.length; i++) {
callback(array[i], breakout, i);
if (broke) {
return breakoutValue;
}
}
function breakout(conditional, value) {
if (conditional) {
broke = true;
breakoutValue = value;
}
}
}
function isEmpty(value) {
if (!value) {
return true;
}
else if (hasOwnProperty(value, 'length')) {
return lengthEquals(value, 0);
}
else if (typeof value === 'object') {
return lengthEquals(Object.keys(value), 0);
}
return false;
}
var isNotEmpty = bindNot(isEmpty);
function isPositive(value) {
return greaterThan(value, 0);
}
exports.StringObject = StringObject;
exports.asArray = asArray;
exports.assign = assign;
exports.bindNot = bindNot;
exports.bus = bus;
exports.cache = createCache;
exports.callEach = callEach;
exports.defaultTo = defaultTo;
exports.deferThrow = deferThrow;
exports.either = either;
exports.greaterThan = greaterThan;
exports.hasOwnProperty = hasOwnProperty;
exports.invariant = invariant;
exports.isArray = isArray;
exports.isBoolean = isBoolean;
exports.isEmpty = isEmpty;
exports.isFunction = isFunction;
exports.isNotArray = isNotArray;
exports.isNotEmpty = isNotEmpty;
exports.isNotNull = isNotNull;
exports.isNotNullish = isNotNullish;
exports.isNotNumeric = isNotNumeric;
exports.isNotUndefined = isNotUndefined;
exports.isNull = isNull;
exports.isNullish = isNullish;
exports.isNumeric = isNumeric;
exports.isPositive = isPositive;
exports.isPromise = isPromise;
exports.isStringValue = isStringValue;
exports.isUndefined = isUndefined;
exports.last = last;
exports.lengthEquals = lengthEquals;
exports.lengthNotEquals = lengthNotEquals;
exports.longerThan = longerThan;
exports.mapFirst = mapFirst;
exports.nestedArray = nestedArray;
exports.numberEquals = numberEquals;
exports.numberNotEquals = numberNotEquals;
exports.optionalFunctionValue = optionalFunctionValue;
exports.seq = seq;

2

dist/cjs/vest-utils.production.js

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

"use strict";
"use strict";function t(t){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return!t.apply(void 0,r)}}function r(t){var r=Number(t);return!(isNaN(parseFloat(String(t)))||isNaN(Number(t))||!isFinite(r))}Object.defineProperty(exports,"__esModule",{value:!0});var n=t(r);function e(t,n){return r(t)&&r(n)&&Number(t)===Number(n)}var o=t(e);function u(t,r){return e(t.length,r)}var i=t(u);function s(t,n){return r(t)&&r(n)&&Number(t)>Number(n)}function c(t,r){return s(t.length,r)}function a(t){return null===t}var f=t(a);function p(t){return void 0===t}var l=t(p);function x(t){return a(t)||p(t)}var v=t(x);function h(t){return[].concat(t)}function g(t){return"function"==typeof t}function N(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return g(t)?t.apply(void 0,r):t}function d(t,r){var n;return null!==(n=N(t))&&void 0!==n?n:N(r)}function b(t){return!!Array.isArray(t)}var y=t(b);function m(t){return(t=h(t))[t.length-1]}function E(t,r){var n=0;for(r=r.slice(0,-1);n<r.length;n++){var e=r[n];t[e]=d(t[e],[]),t=t[e]}return t}var O=Object.freeze({__proto__:null,transform:function t(r,n){for(var e=[],o=0;o<r.length;o++){var u=r[o];b(u)?e.push(t(u,n)):(u=n(u),f(u)&&e.push(u))}return e},valueAtPath:function(t,r){return E(t,r)[m(r)]},setValueAtPath:function(t,r,n){return E(t,r)[m(r)]=n,t},flatten:function t(r){return h(r).reduce((function(r,n){return b(n)?r.concat(t(n)):h(r).concat(n)}),[])},getCurrent:E});function _(t,r){return Object.prototype.hasOwnProperty.call(t,r)}var j=Object.assign;var A,P=Object.freeze({__proto__:null,createBus:function(){var t={};return{emit:function(r,n){(t[r]||[]).forEach((function(t){t(n)}))},on:function(r,n){return t[r]=(t[r]||[]).concat(n),{off:function(){t[r]=(t[r]||[]).filter((function(t){return t!==n}))}}}}}}),w=(A=0,function(){return"".concat(A++)});function S(t){return!t||(_(t,"length")?u(t,0):"object"==typeof t&&u(Object.keys(t),0))}var q=t(S);exports.StringObject=function(t){return new String(N(t))},exports.asArray=h,exports.assign=j,exports.bindNot=t,exports.bus=P,exports.cache=function(t){function r(t){return n.findIndex((function(r){var n=r[0];return u(t,n.length)&&t.every((function(t,r){return t===n[r]}))}))}void 0===t&&(t=1);var n=[],e=function(r,o){var u=e.get(r);return u?u[1]:(o=o(),n.unshift([r.concat(),o]),c(n,t)&&(n.length=t),o)};return e.invalidate=function(t){-1<(t=r(t))&&n.splice(t,1)},e.get=function(t){return n[r(t)]||null},e},exports.callEach=function(t){return t.forEach((function(t){return t()}))},exports.defaultTo=d,exports.deferThrow=function(t){setTimeout((function(){throw Error(t)}),0)},exports.either=function(t,r){return!!t!=!!r},exports.greaterThan=s,exports.hasOwnProperty=_,exports.invariant=function(t,r){if(!t)throw r instanceof String?r.valueOf():Error(r?N(r):r)},exports.isArray=b,exports.isBoolean=function(t){return!!t===t},exports.isEmpty=S,exports.isFunction=g,exports.isNotArray=y,exports.isNotEmpty=q,exports.isNotNull=f,exports.isNotNullish=v,exports.isNotNumeric=n,exports.isNotUndefined=l,exports.isNull=a,exports.isNullish=x,exports.isNumeric=r,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=p,exports.last=m,exports.lengthEquals=u,exports.lengthNotEquals=i,exports.longerThan=c,exports.mapFirst=function(t,r){function n(t,r){t&&(e=!0,o=r)}for(var e=!1,o=null,u=0;u<t.length;u++)if(r(t[u],n,u),e)return o},exports.nestedArray=O,exports.numberEquals=e,exports.numberNotEquals=o,exports.optionalFunctionValue=N,exports.seq=w;

@@ -0,1 +1,299 @@

function bindNot(fn) {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return !fn.apply(void 0, args);
};
}
function isNumeric(value) {
var str = String(value);
var num = Number(value);
var result = !isNaN(parseFloat(str)) && !isNaN(Number(value)) && isFinite(num);
return Boolean(result);
}
var isNotNumeric = bindNot(isNumeric);
function numberEquals(value, eq) {
return isNumeric(value) && isNumeric(eq) && Number(value) === Number(eq);
}
var numberNotEquals = bindNot(numberEquals);
function lengthEquals(value, arg1) {
return numberEquals(value.length, arg1);
}
var lengthNotEquals = bindNot(lengthEquals);
function greaterThan(value, gt) {
return isNumeric(value) && isNumeric(gt) && Number(value) > Number(gt);
}
function longerThan(value, arg1) {
return greaterThan(value.length, arg1);
}
/**
* Creates a cache function
*/
function createCache(maxSize) {
if (maxSize === void 0) { maxSize = 1; }
var cacheStorage = [];
var cache = function (deps, cacheAction) {
var cacheHit = cache.get(deps);
// cache hit is not null
if (cacheHit)
return cacheHit[1];
var result = cacheAction();
cacheStorage.unshift([deps.concat(), result]);
if (longerThan(cacheStorage, maxSize))
cacheStorage.length = maxSize;
return result;
};
// invalidate an item in the cache by its dependencies
cache.invalidate = function (deps) {
var index = findIndex(deps);
if (index > -1)
cacheStorage.splice(index, 1);
};
// Retrieves an item from the cache.
cache.get = function (deps) {
return cacheStorage[findIndex(deps)] || null;
};
return cache;
function findIndex(deps) {
return cacheStorage.findIndex(function (_a) {
var cachedDeps = _a[0];
return lengthEquals(deps, cachedDeps.length) &&
deps.every(function (dep, i) { return dep === cachedDeps[i]; });
});
}
}
function isNull(value) {
return value === null;
}
var isNotNull = bindNot(isNull);
function isUndefined(value) {
return value === undefined;
}
var isNotUndefined = bindNot(isUndefined);
function isNullish(value) {
return isNull(value) || isUndefined(value);
}
var isNotNullish = bindNot(isNullish);
function asArray(possibleArg) {
return [].concat(possibleArg);
}
function isFunction(value) {
return typeof value === 'function';
}
function optionalFunctionValue(value) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return isFunction(value) ? value.apply(void 0, args) : value;
}
function defaultTo(value, defaultValue) {
var _a;
return (_a = optionalFunctionValue(value)) !== null && _a !== void 0 ? _a : optionalFunctionValue(defaultValue);
}
// The module is named "isArrayValue" since it
// is conflicting with a nested npm dependency.
// We may need to revisit this in the future.
function isArray(value) {
return Boolean(Array.isArray(value));
}
var isNotArray = bindNot(isArray);
function last(values) {
var valuesArray = asArray(values);
return valuesArray[valuesArray.length - 1];
}
// This is kind of a map/filter in one function.
// Normally, behaves like a nested-array map,
// but returning `null` will drop the element from the array
function transform(array, cb) {
var res = [];
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
var v = array_1[_i];
if (isArray(v)) {
res.push(transform(v, cb));
}
else {
var output = cb(v);
if (isNotNull(output)) {
res.push(output);
}
}
}
return res;
}
function valueAtPath(array, path) {
return getCurrent(array, path)[last(path)];
}
function setValueAtPath(array, path, value) {
var current = getCurrent(array, path);
current[last(path)] = value;
return array;
}
function flatten(values) {
return asArray(values).reduce(function (acc, value) {
if (isArray(value)) {
return acc.concat(flatten(value));
}
return asArray(acc).concat(value);
}, []);
}
function getCurrent(array, path) {
var current = array;
for (var _i = 0, _a = path.slice(0, -1); _i < _a.length; _i++) {
var p = _a[_i];
current[p] = defaultTo(current[p], []);
current = current[p];
}
return current;
}
var nestedArray = /*#__PURE__*/Object.freeze({
__proto__: null,
transform: transform,
valueAtPath: valueAtPath,
setValueAtPath: setValueAtPath,
flatten: flatten,
getCurrent: getCurrent
});
function callEach(arr) {
return arr.forEach(function (fn) { return fn(); });
}
/**
* A safe hasOwnProperty access
*/
function hasOwnProperty(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isPromise(value) {
return value && isFunction(value.then);
}
var assign = Object.assign;
function invariant(condition,
// eslint-disable-next-line @typescript-eslint/ban-types
message) {
if (condition) {
return;
}
// If message is a string object (rather than string literal)
// Throw the value directly as a string
// Alternatively, throw an error with the message
throw message instanceof String
? message.valueOf()
: new Error(message ? optionalFunctionValue(message) : message);
}
// eslint-disable-next-line @typescript-eslint/ban-types
function StringObject(value) {
return new String(optionalFunctionValue(value));
}
function isStringValue(v) {
return String(v) === v;
}
function either(a, b) {
return !!a !== !!b;
}
function isBoolean(value) {
return !!value === value;
}
function deferThrow(message) {
setTimeout(function () {
throw new Error(message);
}, 0);
}
function createBus() {
var listeners = {};
return {
emit: function (event, data) {
listener(event).forEach(function (handler) {
handler(data);
});
},
on: function (event, handler) {
listeners[event] = listener(event).concat(handler);
return {
off: function () {
listeners[event] = listener(event).filter(function (h) { return h !== handler; });
}
};
}
};
function listener(event) {
return listeners[event] || [];
}
}
var bus = /*#__PURE__*/Object.freeze({
__proto__: null,
createBus: createBus
});
/**
* @returns a unique numeric id.
*/
var seq = (function (n) { return function () {
return "".concat(n++);
}; })(0);
function mapFirst(array, callback) {
var broke = false;
var breakoutValue = null;
for (var i = 0; i < array.length; i++) {
callback(array[i], breakout, i);
if (broke) {
return breakoutValue;
}
}
function breakout(conditional, value) {
if (conditional) {
broke = true;
breakoutValue = value;
}
}
}
function isEmpty(value) {
if (!value) {
return true;
}
else if (hasOwnProperty(value, 'length')) {
return lengthEquals(value, 0);
}
else if (typeof value === 'object') {
return lengthEquals(Object.keys(value), 0);
}
return false;
}
var isNotEmpty = bindNot(isEmpty);
function isPositive(value) {
return greaterThan(value, 0);
}
export { StringObject, asArray, assign, bindNot, bus, createCache as cache, callEach, defaultTo, deferThrow, either, greaterThan, hasOwnProperty, invariant, isArray, isBoolean, isEmpty, isFunction, isNotArray, isNotEmpty, isNotNull, isNotNullish, isNotNumeric, isNotUndefined, isNull, isNullish, isNumeric, isPositive, isPromise, isStringValue, isUndefined, last, lengthEquals, lengthNotEquals, longerThan, mapFirst, nestedArray, numberEquals, numberNotEquals, optionalFunctionValue, seq };

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

function n(n){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return!n.apply(void 0,t)}}function t(n){var t=Number(n);return!(isNaN(parseFloat(String(n)))||isNaN(Number(n))||!isFinite(t))}var r=n(t);function u(n,r){return t(n)&&t(r)&&Number(n)===Number(r)}var e=n(u);function o(n,t){return u(n.length,t)}var i=n(o);function a(n,r){return t(n)&&t(r)&&Number(n)>Number(r)}function c(n,t){return a(n.length,t)}function f(n){return null===n}var s=n(f);function l(n){return void 0===n}var v=n(l);function h(n){return null===n||l(n)}var N=n(h);function g(n){return[].concat(n)}function p(n){return"function"==typeof n}function b(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return p(n)?n.apply(void 0,t):n}function d(n,t){var r;return null!==(r=b(n))&&void 0!==r?r:b(t)}function y(n){return!!Array.isArray(n)}var m=n(y);function E(n){return(n=g(n))[n.length-1]}function A(n,t){var r=0;for(t=t.slice(0,-1);r<t.length;r++){var u=t[r];n[u]=d(n[u],[]),n=n[u]}return n}var _=Object.freeze({__proto__:null,transform:function n(t,r){for(var u=[],e=0;e<t.length;e++){var o=t[e];y(o)?u.push(n(o,r)):(o=r(o),s(o)&&u.push(o))}return u},valueAtPath:function(n,t){return A(n,t)[E(t)]},setValueAtPath:function(n,t,r){return A(n,t)[E(t)]=r,n},flatten:function n(t){return g(t).reduce((function(t,r){return y(r)?t.concat(n(r)):g(t).concat(r)}),[])},getCurrent:A});function O(n,t){return Object.prototype.hasOwnProperty.call(n,t)}var j,q=Object.assign,w=Object.freeze({__proto__:null,createBus:function(){var n={};return{emit:function(t,r){(n[t]||[]).forEach((function(n){n(r)}))},on:function(t,r){return n[t]=(n[t]||[]).concat(r),{off:function(){n[t]=(n[t]||[]).filter((function(n){return n!==r}))}}}}}}),F=(j=0,function(){return"".concat(j++)});function S(n){return!n||(O(n,"length")?o(n,0):"object"==typeof n&&o(Object.keys(n),0))}var T=n(S);function P(n){return new String(b(n))}function x(n){function t(r,e){var o=t.get(r);return o?o[1]:(e=e(),u.unshift([r.concat(),e]),c(u,n)&&(u.length=n),e)}function r(n){return u.findIndex((function(t){var r=t[0];return o(n,r.length)&&n.every((function(n,t){return n===r[t]}))}))}void 0===n&&(n=1);var u=[];return t.invalidate=function(n){-1<(n=r(n))&&u.splice(n,1)},t.get=function(n){return u[r(n)]||null},t}function z(n){return n.forEach((function(n){return n()}))}function U(n){setTimeout((function(){throw Error(n)}),0)}function V(n,t){return!!n!=!!t}function k(n,t){if(!n)throw t instanceof String?t.valueOf():Error(t?b(t):t)}function B(n){return!!n===n}function C(n){return a(n,0)}function I(n){return n&&p(n.then)}function D(n){return String(n)===n}function G(n,t){function r(n,t){n&&(u=!0,e=t)}for(var u=!1,e=null,o=0;o<n.length;o++)if(t(n[o],r,o),u)return e}export{P as StringObject,g as asArray,q as assign,n as bindNot,w as bus,x as cache,z as callEach,d as defaultTo,U as deferThrow,V as either,a as greaterThan,O as hasOwnProperty,k as invariant,y as isArray,B as isBoolean,S as isEmpty,p as isFunction,m as isNotArray,T as isNotEmpty,s as isNotNull,N as isNotNullish,r as isNotNumeric,v as isNotUndefined,f as isNull,h as isNullish,t as isNumeric,C as isPositive,I as isPromise,D as isStringValue,l as isUndefined,E as last,o as lengthEquals,i as lengthNotEquals,c as longerThan,G as mapFirst,_ as nestedArray,u as numberEquals,e as numberNotEquals,b as optionalFunctionValue,F as seq};

@@ -1,8 +0,348 @@

(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
factory();
}((function () { 'use strict';
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['vest-utils'] = {}));
}(this, (function (exports) { 'use strict';
function bindNot(fn) {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return !fn.apply(void 0, args);
};
}
function isNumeric(value) {
var str = String(value);
var num = Number(value);
var result = !isNaN(parseFloat(str)) && !isNaN(Number(value)) && isFinite(num);
return Boolean(result);
}
var isNotNumeric = bindNot(isNumeric);
function numberEquals(value, eq) {
return isNumeric(value) && isNumeric(eq) && Number(value) === Number(eq);
}
var numberNotEquals = bindNot(numberEquals);
function lengthEquals(value, arg1) {
return numberEquals(value.length, arg1);
}
var lengthNotEquals = bindNot(lengthEquals);
function greaterThan(value, gt) {
return isNumeric(value) && isNumeric(gt) && Number(value) > Number(gt);
}
function longerThan(value, arg1) {
return greaterThan(value.length, arg1);
}
/**
* Creates a cache function
*/
function createCache(maxSize) {
if (maxSize === void 0) { maxSize = 1; }
var cacheStorage = [];
var cache = function (deps, cacheAction) {
var cacheHit = cache.get(deps);
// cache hit is not null
if (cacheHit)
return cacheHit[1];
var result = cacheAction();
cacheStorage.unshift([deps.concat(), result]);
if (longerThan(cacheStorage, maxSize))
cacheStorage.length = maxSize;
return result;
};
// invalidate an item in the cache by its dependencies
cache.invalidate = function (deps) {
var index = findIndex(deps);
if (index > -1)
cacheStorage.splice(index, 1);
};
// Retrieves an item from the cache.
cache.get = function (deps) {
return cacheStorage[findIndex(deps)] || null;
};
return cache;
function findIndex(deps) {
return cacheStorage.findIndex(function (_a) {
var cachedDeps = _a[0];
return lengthEquals(deps, cachedDeps.length) &&
deps.every(function (dep, i) { return dep === cachedDeps[i]; });
});
}
}
function isNull(value) {
return value === null;
}
var isNotNull = bindNot(isNull);
function isUndefined(value) {
return value === undefined;
}
var isNotUndefined = bindNot(isUndefined);
function isNullish(value) {
return isNull(value) || isUndefined(value);
}
var isNotNullish = bindNot(isNullish);
function asArray(possibleArg) {
return [].concat(possibleArg);
}
function isFunction(value) {
return typeof value === 'function';
}
function optionalFunctionValue(value) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
return isFunction(value) ? value.apply(void 0, args) : value;
}
function defaultTo(value, defaultValue) {
var _a;
return (_a = optionalFunctionValue(value)) !== null && _a !== void 0 ? _a : optionalFunctionValue(defaultValue);
}
// The module is named "isArrayValue" since it
// is conflicting with a nested npm dependency.
// We may need to revisit this in the future.
function isArray(value) {
return Boolean(Array.isArray(value));
}
var isNotArray = bindNot(isArray);
function last(values) {
var valuesArray = asArray(values);
return valuesArray[valuesArray.length - 1];
}
// This is kind of a map/filter in one function.
// Normally, behaves like a nested-array map,
// but returning `null` will drop the element from the array
function transform(array, cb) {
var res = [];
for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
var v = array_1[_i];
if (isArray(v)) {
res.push(transform(v, cb));
}
else {
var output = cb(v);
if (isNotNull(output)) {
res.push(output);
}
}
}
return res;
}
function valueAtPath(array, path) {
return getCurrent(array, path)[last(path)];
}
function setValueAtPath(array, path, value) {
var current = getCurrent(array, path);
current[last(path)] = value;
return array;
}
function flatten(values) {
return asArray(values).reduce(function (acc, value) {
if (isArray(value)) {
return acc.concat(flatten(value));
}
return asArray(acc).concat(value);
}, []);
}
function getCurrent(array, path) {
var current = array;
for (var _i = 0, _a = path.slice(0, -1); _i < _a.length; _i++) {
var p = _a[_i];
current[p] = defaultTo(current[p], []);
current = current[p];
}
return current;
}
var nestedArray = /*#__PURE__*/Object.freeze({
__proto__: null,
transform: transform,
valueAtPath: valueAtPath,
setValueAtPath: setValueAtPath,
flatten: flatten,
getCurrent: getCurrent
});
function callEach(arr) {
return arr.forEach(function (fn) { return fn(); });
}
/**
* A safe hasOwnProperty access
*/
function hasOwnProperty(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function isPromise(value) {
return value && isFunction(value.then);
}
var assign = Object.assign;
function invariant(condition,
// eslint-disable-next-line @typescript-eslint/ban-types
message) {
if (condition) {
return;
}
// If message is a string object (rather than string literal)
// Throw the value directly as a string
// Alternatively, throw an error with the message
throw message instanceof String
? message.valueOf()
: new Error(message ? optionalFunctionValue(message) : message);
}
// eslint-disable-next-line @typescript-eslint/ban-types
function StringObject(value) {
return new String(optionalFunctionValue(value));
}
function isStringValue(v) {
return String(v) === v;
}
function either(a, b) {
return !!a !== !!b;
}
function isBoolean(value) {
return !!value === value;
}
function deferThrow(message) {
setTimeout(function () {
throw new Error(message);
}, 0);
}
function createBus() {
var listeners = {};
return {
emit: function (event, data) {
listener(event).forEach(function (handler) {
handler(data);
});
},
on: function (event, handler) {
listeners[event] = listener(event).concat(handler);
return {
off: function () {
listeners[event] = listener(event).filter(function (h) { return h !== handler; });
}
};
}
};
function listener(event) {
return listeners[event] || [];
}
}
var bus = /*#__PURE__*/Object.freeze({
__proto__: null,
createBus: createBus
});
/**
* @returns a unique numeric id.
*/
var seq = (function (n) { return function () {
return "".concat(n++);
}; })(0);
function mapFirst(array, callback) {
var broke = false;
var breakoutValue = null;
for (var i = 0; i < array.length; i++) {
callback(array[i], breakout, i);
if (broke) {
return breakoutValue;
}
}
function breakout(conditional, value) {
if (conditional) {
broke = true;
breakoutValue = value;
}
}
}
function isEmpty(value) {
if (!value) {
return true;
}
else if (hasOwnProperty(value, 'length')) {
return lengthEquals(value, 0);
}
else if (typeof value === 'object') {
return lengthEquals(Object.keys(value), 0);
}
return false;
}
var isNotEmpty = bindNot(isEmpty);
function isPositive(value) {
return greaterThan(value, 0);
}
exports.StringObject = StringObject;
exports.asArray = asArray;
exports.assign = assign;
exports.bindNot = bindNot;
exports.bus = bus;
exports.cache = createCache;
exports.callEach = callEach;
exports.defaultTo = defaultTo;
exports.deferThrow = deferThrow;
exports.either = either;
exports.greaterThan = greaterThan;
exports.hasOwnProperty = hasOwnProperty;
exports.invariant = invariant;
exports.isArray = isArray;
exports.isBoolean = isBoolean;
exports.isEmpty = isEmpty;
exports.isFunction = isFunction;
exports.isNotArray = isNotArray;
exports.isNotEmpty = isNotEmpty;
exports.isNotNull = isNotNull;
exports.isNotNullish = isNotNullish;
exports.isNotNumeric = isNotNumeric;
exports.isNotUndefined = isNotUndefined;
exports.isNull = isNull;
exports.isNullish = isNullish;
exports.isNumeric = isNumeric;
exports.isPositive = isPositive;
exports.isPromise = isPromise;
exports.isStringValue = isStringValue;
exports.isUndefined = isUndefined;
exports.last = last;
exports.lengthEquals = lengthEquals;
exports.lengthNotEquals = lengthNotEquals;
exports.longerThan = longerThan;
exports.mapFirst = mapFirst;
exports.nestedArray = nestedArray;
exports.numberEquals = numberEquals;
exports.numberNotEquals = numberNotEquals;
exports.optionalFunctionValue = optionalFunctionValue;
exports.seq = seq;
Object.defineProperty(exports, '__esModule', { value: true });
})));

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

"use strict";!function(n){"function"==typeof define&&define.amd&&define(n)}((function(){}));
"use strict";!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){function t(n){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return!n.apply(void 0,t)}}function r(n){var t=Number(n);return!(isNaN(parseFloat(String(n)))||isNaN(Number(n))||!isFinite(t))}function e(n,t){return r(n)&&r(t)&&Number(n)===Number(t)}function u(n,t){return e(n.length,t)}function i(n,t){return r(n)&&r(t)&&Number(n)>Number(t)}function o(n,t){return i(n.length,t)}function c(n){return null===n}function f(n){return void 0===n}function a(n){return null===n||f(n)}function l(n){return[].concat(n)}function s(n){return"function"==typeof n}function h(n){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return s(n)?n.apply(void 0,t):n}function d(n,t){var r;return null!==(r=h(n))&&void 0!==r?r:h(t)}function g(n){return!!Array.isArray(n)}function p(n){return(n=l(n))[n.length-1]}function v(n,t){var r=0;for(t=t.slice(0,-1);r<t.length;r++){var e=t[r];n[e]=d(n[e],[]),n=n[e]}return n}function N(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function y(n){return!n||(N(n,"length")?u(n,0):"object"==typeof n&&u(Object.keys(n),0))}var b,m=t(r),E=t(e),O=t(u),_=t(c),j=t(f),A=t(a),P=t(g),T=Object.freeze({__proto__:null,transform:function n(t,r){for(var e=[],u=0;u<t.length;u++){var i=t[u];g(i)?e.push(n(i,r)):(i=r(i),_(i)&&e.push(i))}return e},valueAtPath:function(n,t){return v(n,t)[p(t)]},setValueAtPath:function(n,t,r){return v(n,t)[p(t)]=r,n},flatten:function n(t){return l(t).reduce((function(t,r){return g(r)?t.concat(n(r)):l(t).concat(r)}),[])},getCurrent:v}),w=Object.assign,S=Object.freeze({__proto__:null,createBus:function(){var n={};return{emit:function(t,r){(n[t]||[]).forEach((function(n){n(r)}))},on:function(t,r){return n[t]=(n[t]||[]).concat(r),{off:function(){n[t]=(n[t]||[]).filter((function(n){return n!==r}))}}}}}}),q=(b=0,function(){return"".concat(b++)}),F=t(y);n.StringObject=function(n){return new String(h(n))},n.asArray=l,n.assign=w,n.bindNot=t,n.bus=S,n.cache=function(n){function t(n){return r.findIndex((function(t){var r=t[0];return u(n,r.length)&&n.every((function(n,t){return n===r[t]}))}))}void 0===n&&(n=1);var r=[],e=function(t,u){var i=e.get(t);return i?i[1]:(u=u(),r.unshift([t.concat(),u]),o(r,n)&&(r.length=n),u)};return e.invalidate=function(n){-1<(n=t(n))&&r.splice(n,1)},e.get=function(n){return r[t(n)]||null},e},n.callEach=function(n){return n.forEach((function(n){return n()}))},n.defaultTo=d,n.deferThrow=function(n){setTimeout((function(){throw Error(n)}),0)},n.either=function(n,t){return!!n!=!!t},n.greaterThan=i,n.hasOwnProperty=N,n.invariant=function(n,t){if(!n)throw t instanceof String?t.valueOf():Error(t?h(t):t)},n.isArray=g,n.isBoolean=function(n){return!!n===n},n.isEmpty=y,n.isFunction=s,n.isNotArray=P,n.isNotEmpty=F,n.isNotNull=_,n.isNotNullish=A,n.isNotNumeric=m,n.isNotUndefined=j,n.isNull=c,n.isNullish=a,n.isNumeric=r,n.isPositive=function(n){return i(n,0)},n.isPromise=function(n){return n&&s(n.then)},n.isStringValue=function(n){return String(n)===n},n.isUndefined=f,n.last=p,n.lengthEquals=u,n.lengthNotEquals=O,n.longerThan=o,n.mapFirst=function(n,t){function r(n,t){n&&(e=!0,u=t)}for(var e=!1,u=null,i=0;i<n.length;i++)if(t(n[i],r,i),e)return u},n.nestedArray=T,n.numberEquals=e,n.numberNotEquals=E,n.optionalFunctionValue=h,n.seq=q,Object.defineProperty(n,"__esModule",{value:!0})}));
{
"version": "0.0.1-rc",
"version": "0.0.2-dev-9b46fb",
"name": "vest-utils",
"author": "ealush",
"scripts": {
"test": "vx test"
"test": "vx test",
"build": "vx build",
"release": "vx release"
},

@@ -22,662 +24,2 @@ "main": "./dist/cjs/vest-utils.js",

"exports": {
"./asArray": {
"production": {
"types": "./types/asArray.d.ts",
"browser": "./dist/es/asArray.production.js",
"umd": "./dist/umd/asArray.production.js",
"import": "./dist/es/asArray.production.js",
"require": "./dist/cjs/asArray.production.js",
"node": "./dist/cjs/asArray.production.js",
"module": "./dist/es/asArray.production.js",
"default": "./dist/cjs/asArray.production.js"
},
"development": {
"types": "./types/asArray.d.ts",
"browser": "./dist/es/asArray.development.js",
"umd": "./dist/umd/asArray.development.js",
"import": "./dist/es/asArray.development.js",
"require": "./dist/cjs/asArray.development.js",
"node": "./dist/cjs/asArray.development.js",
"module": "./dist/es/asArray.development.js",
"default": "./dist/cjs/asArray.development.js"
},
"types": "./types/asArray.d.ts",
"browser": "./dist/es/asArray.production.js",
"umd": "./dist/umd/asArray.production.js",
"import": "./dist/es/asArray.production.js",
"require": "./dist/cjs/asArray.production.js",
"node": "./dist/cjs/asArray.production.js",
"module": "./dist/es/asArray.production.js",
"default": "./dist/cjs/asArray.production.js"
},
"./assign": {
"production": {
"types": "./types/assign.d.ts",
"browser": "./dist/es/assign.production.js",
"umd": "./dist/umd/assign.production.js",
"import": "./dist/es/assign.production.js",
"require": "./dist/cjs/assign.production.js",
"node": "./dist/cjs/assign.production.js",
"module": "./dist/es/assign.production.js",
"default": "./dist/cjs/assign.production.js"
},
"development": {
"types": "./types/assign.d.ts",
"browser": "./dist/es/assign.development.js",
"umd": "./dist/umd/assign.development.js",
"import": "./dist/es/assign.development.js",
"require": "./dist/cjs/assign.development.js",
"node": "./dist/cjs/assign.development.js",
"module": "./dist/es/assign.development.js",
"default": "./dist/cjs/assign.development.js"
},
"types": "./types/assign.d.ts",
"browser": "./dist/es/assign.production.js",
"umd": "./dist/umd/assign.production.js",
"import": "./dist/es/assign.production.js",
"require": "./dist/cjs/assign.production.js",
"node": "./dist/cjs/assign.production.js",
"module": "./dist/es/assign.production.js",
"default": "./dist/cjs/assign.production.js"
},
"./bindNot": {
"production": {
"types": "./types/bindNot.d.ts",
"browser": "./dist/es/bindNot.production.js",
"umd": "./dist/umd/bindNot.production.js",
"import": "./dist/es/bindNot.production.js",
"require": "./dist/cjs/bindNot.production.js",
"node": "./dist/cjs/bindNot.production.js",
"module": "./dist/es/bindNot.production.js",
"default": "./dist/cjs/bindNot.production.js"
},
"development": {
"types": "./types/bindNot.d.ts",
"browser": "./dist/es/bindNot.development.js",
"umd": "./dist/umd/bindNot.development.js",
"import": "./dist/es/bindNot.development.js",
"require": "./dist/cjs/bindNot.development.js",
"node": "./dist/cjs/bindNot.development.js",
"module": "./dist/es/bindNot.development.js",
"default": "./dist/cjs/bindNot.development.js"
},
"types": "./types/bindNot.d.ts",
"browser": "./dist/es/bindNot.production.js",
"umd": "./dist/umd/bindNot.production.js",
"import": "./dist/es/bindNot.production.js",
"require": "./dist/cjs/bindNot.production.js",
"node": "./dist/cjs/bindNot.production.js",
"module": "./dist/es/bindNot.production.js",
"default": "./dist/cjs/bindNot.production.js"
},
"./bus": {
"production": {
"types": "./types/bus.d.ts",
"browser": "./dist/es/bus.production.js",
"umd": "./dist/umd/bus.production.js",
"import": "./dist/es/bus.production.js",
"require": "./dist/cjs/bus.production.js",
"node": "./dist/cjs/bus.production.js",
"module": "./dist/es/bus.production.js",
"default": "./dist/cjs/bus.production.js"
},
"development": {
"types": "./types/bus.d.ts",
"browser": "./dist/es/bus.development.js",
"umd": "./dist/umd/bus.development.js",
"import": "./dist/es/bus.development.js",
"require": "./dist/cjs/bus.development.js",
"node": "./dist/cjs/bus.development.js",
"module": "./dist/es/bus.development.js",
"default": "./dist/cjs/bus.development.js"
},
"types": "./types/bus.d.ts",
"browser": "./dist/es/bus.production.js",
"umd": "./dist/umd/bus.production.js",
"import": "./dist/es/bus.production.js",
"require": "./dist/cjs/bus.production.js",
"node": "./dist/cjs/bus.production.js",
"module": "./dist/es/bus.production.js",
"default": "./dist/cjs/bus.production.js"
},
"./cache": {
"production": {
"types": "./types/cache.d.ts",
"browser": "./dist/es/cache.production.js",
"umd": "./dist/umd/cache.production.js",
"import": "./dist/es/cache.production.js",
"require": "./dist/cjs/cache.production.js",
"node": "./dist/cjs/cache.production.js",
"module": "./dist/es/cache.production.js",
"default": "./dist/cjs/cache.production.js"
},
"development": {
"types": "./types/cache.d.ts",
"browser": "./dist/es/cache.development.js",
"umd": "./dist/umd/cache.development.js",
"import": "./dist/es/cache.development.js",
"require": "./dist/cjs/cache.development.js",
"node": "./dist/cjs/cache.development.js",
"module": "./dist/es/cache.development.js",
"default": "./dist/cjs/cache.development.js"
},
"types": "./types/cache.d.ts",
"browser": "./dist/es/cache.production.js",
"umd": "./dist/umd/cache.production.js",
"import": "./dist/es/cache.production.js",
"require": "./dist/cjs/cache.production.js",
"node": "./dist/cjs/cache.production.js",
"module": "./dist/es/cache.production.js",
"default": "./dist/cjs/cache.production.js"
},
"./callEach": {
"production": {
"types": "./types/callEach.d.ts",
"browser": "./dist/es/callEach.production.js",
"umd": "./dist/umd/callEach.production.js",
"import": "./dist/es/callEach.production.js",
"require": "./dist/cjs/callEach.production.js",
"node": "./dist/cjs/callEach.production.js",
"module": "./dist/es/callEach.production.js",
"default": "./dist/cjs/callEach.production.js"
},
"development": {
"types": "./types/callEach.d.ts",
"browser": "./dist/es/callEach.development.js",
"umd": "./dist/umd/callEach.development.js",
"import": "./dist/es/callEach.development.js",
"require": "./dist/cjs/callEach.development.js",
"node": "./dist/cjs/callEach.development.js",
"module": "./dist/es/callEach.development.js",
"default": "./dist/cjs/callEach.development.js"
},
"types": "./types/callEach.d.ts",
"browser": "./dist/es/callEach.production.js",
"umd": "./dist/umd/callEach.production.js",
"import": "./dist/es/callEach.production.js",
"require": "./dist/cjs/callEach.production.js",
"node": "./dist/cjs/callEach.production.js",
"module": "./dist/es/callEach.production.js",
"default": "./dist/cjs/callEach.production.js"
},
"./defaultTo": {
"production": {
"types": "./types/defaultTo.d.ts",
"browser": "./dist/es/defaultTo.production.js",
"umd": "./dist/umd/defaultTo.production.js",
"import": "./dist/es/defaultTo.production.js",
"require": "./dist/cjs/defaultTo.production.js",
"node": "./dist/cjs/defaultTo.production.js",
"module": "./dist/es/defaultTo.production.js",
"default": "./dist/cjs/defaultTo.production.js"
},
"development": {
"types": "./types/defaultTo.d.ts",
"browser": "./dist/es/defaultTo.development.js",
"umd": "./dist/umd/defaultTo.development.js",
"import": "./dist/es/defaultTo.development.js",
"require": "./dist/cjs/defaultTo.development.js",
"node": "./dist/cjs/defaultTo.development.js",
"module": "./dist/es/defaultTo.development.js",
"default": "./dist/cjs/defaultTo.development.js"
},
"types": "./types/defaultTo.d.ts",
"browser": "./dist/es/defaultTo.production.js",
"umd": "./dist/umd/defaultTo.production.js",
"import": "./dist/es/defaultTo.production.js",
"require": "./dist/cjs/defaultTo.production.js",
"node": "./dist/cjs/defaultTo.production.js",
"module": "./dist/es/defaultTo.production.js",
"default": "./dist/cjs/defaultTo.production.js"
},
"./either": {
"production": {
"types": "./types/either.d.ts",
"browser": "./dist/es/either.production.js",
"umd": "./dist/umd/either.production.js",
"import": "./dist/es/either.production.js",
"require": "./dist/cjs/either.production.js",
"node": "./dist/cjs/either.production.js",
"module": "./dist/es/either.production.js",
"default": "./dist/cjs/either.production.js"
},
"development": {
"types": "./types/either.d.ts",
"browser": "./dist/es/either.development.js",
"umd": "./dist/umd/either.development.js",
"import": "./dist/es/either.development.js",
"require": "./dist/cjs/either.development.js",
"node": "./dist/cjs/either.development.js",
"module": "./dist/es/either.development.js",
"default": "./dist/cjs/either.development.js"
},
"types": "./types/either.d.ts",
"browser": "./dist/es/either.production.js",
"umd": "./dist/umd/either.production.js",
"import": "./dist/es/either.production.js",
"require": "./dist/cjs/either.production.js",
"node": "./dist/cjs/either.production.js",
"module": "./dist/es/either.production.js",
"default": "./dist/cjs/either.production.js"
},
"./genId": {
"production": {
"types": "./types/genId.d.ts",
"browser": "./dist/es/genId.production.js",
"umd": "./dist/umd/genId.production.js",
"import": "./dist/es/genId.production.js",
"require": "./dist/cjs/genId.production.js",
"node": "./dist/cjs/genId.production.js",
"module": "./dist/es/genId.production.js",
"default": "./dist/cjs/genId.production.js"
},
"development": {
"types": "./types/genId.d.ts",
"browser": "./dist/es/genId.development.js",
"umd": "./dist/umd/genId.development.js",
"import": "./dist/es/genId.development.js",
"require": "./dist/cjs/genId.development.js",
"node": "./dist/cjs/genId.development.js",
"module": "./dist/es/genId.development.js",
"default": "./dist/cjs/genId.development.js"
},
"types": "./types/genId.d.ts",
"browser": "./dist/es/genId.production.js",
"umd": "./dist/umd/genId.production.js",
"import": "./dist/es/genId.production.js",
"require": "./dist/cjs/genId.production.js",
"node": "./dist/cjs/genId.production.js",
"module": "./dist/es/genId.production.js",
"default": "./dist/cjs/genId.production.js"
},
"./hasOwnProperty": {
"production": {
"types": "./types/hasOwnProperty.d.ts",
"browser": "./dist/es/hasOwnProperty.production.js",
"umd": "./dist/umd/hasOwnProperty.production.js",
"import": "./dist/es/hasOwnProperty.production.js",
"require": "./dist/cjs/hasOwnProperty.production.js",
"node": "./dist/cjs/hasOwnProperty.production.js",
"module": "./dist/es/hasOwnProperty.production.js",
"default": "./dist/cjs/hasOwnProperty.production.js"
},
"development": {
"types": "./types/hasOwnProperty.d.ts",
"browser": "./dist/es/hasOwnProperty.development.js",
"umd": "./dist/umd/hasOwnProperty.development.js",
"import": "./dist/es/hasOwnProperty.development.js",
"require": "./dist/cjs/hasOwnProperty.development.js",
"node": "./dist/cjs/hasOwnProperty.development.js",
"module": "./dist/es/hasOwnProperty.development.js",
"default": "./dist/cjs/hasOwnProperty.development.js"
},
"types": "./types/hasOwnProperty.d.ts",
"browser": "./dist/es/hasOwnProperty.production.js",
"umd": "./dist/umd/hasOwnProperty.production.js",
"import": "./dist/es/hasOwnProperty.production.js",
"require": "./dist/cjs/hasOwnProperty.production.js",
"node": "./dist/cjs/hasOwnProperty.production.js",
"module": "./dist/es/hasOwnProperty.production.js",
"default": "./dist/cjs/hasOwnProperty.production.js"
},
"./invariant": {
"production": {
"types": "./types/invariant.d.ts",
"browser": "./dist/es/invariant.production.js",
"umd": "./dist/umd/invariant.production.js",
"import": "./dist/es/invariant.production.js",
"require": "./dist/cjs/invariant.production.js",
"node": "./dist/cjs/invariant.production.js",
"module": "./dist/es/invariant.production.js",
"default": "./dist/cjs/invariant.production.js"
},
"development": {
"types": "./types/invariant.d.ts",
"browser": "./dist/es/invariant.development.js",
"umd": "./dist/umd/invariant.development.js",
"import": "./dist/es/invariant.development.js",
"require": "./dist/cjs/invariant.development.js",
"node": "./dist/cjs/invariant.development.js",
"module": "./dist/es/invariant.development.js",
"default": "./dist/cjs/invariant.development.js"
},
"types": "./types/invariant.d.ts",
"browser": "./dist/es/invariant.production.js",
"umd": "./dist/umd/invariant.production.js",
"import": "./dist/es/invariant.production.js",
"require": "./dist/cjs/invariant.production.js",
"node": "./dist/cjs/invariant.production.js",
"module": "./dist/es/invariant.production.js",
"default": "./dist/cjs/invariant.production.js"
},
"./isBooleanValue": {
"production": {
"types": "./types/isBooleanValue.d.ts",
"browser": "./dist/es/isBooleanValue.production.js",
"umd": "./dist/umd/isBooleanValue.production.js",
"import": "./dist/es/isBooleanValue.production.js",
"require": "./dist/cjs/isBooleanValue.production.js",
"node": "./dist/cjs/isBooleanValue.production.js",
"module": "./dist/es/isBooleanValue.production.js",
"default": "./dist/cjs/isBooleanValue.production.js"
},
"development": {
"types": "./types/isBooleanValue.d.ts",
"browser": "./dist/es/isBooleanValue.development.js",
"umd": "./dist/umd/isBooleanValue.development.js",
"import": "./dist/es/isBooleanValue.development.js",
"require": "./dist/cjs/isBooleanValue.development.js",
"node": "./dist/cjs/isBooleanValue.development.js",
"module": "./dist/es/isBooleanValue.development.js",
"default": "./dist/cjs/isBooleanValue.development.js"
},
"types": "./types/isBooleanValue.d.ts",
"browser": "./dist/es/isBooleanValue.production.js",
"umd": "./dist/umd/isBooleanValue.production.js",
"import": "./dist/es/isBooleanValue.production.js",
"require": "./dist/cjs/isBooleanValue.production.js",
"node": "./dist/cjs/isBooleanValue.production.js",
"module": "./dist/es/isBooleanValue.production.js",
"default": "./dist/cjs/isBooleanValue.production.js"
},
"./isFunction": {
"production": {
"types": "./types/isFunction.d.ts",
"browser": "./dist/es/isFunction.production.js",
"umd": "./dist/umd/isFunction.production.js",
"import": "./dist/es/isFunction.production.js",
"require": "./dist/cjs/isFunction.production.js",
"node": "./dist/cjs/isFunction.production.js",
"module": "./dist/es/isFunction.production.js",
"default": "./dist/cjs/isFunction.production.js"
},
"development": {
"types": "./types/isFunction.d.ts",
"browser": "./dist/es/isFunction.development.js",
"umd": "./dist/umd/isFunction.development.js",
"import": "./dist/es/isFunction.development.js",
"require": "./dist/cjs/isFunction.development.js",
"node": "./dist/cjs/isFunction.development.js",
"module": "./dist/es/isFunction.development.js",
"default": "./dist/cjs/isFunction.development.js"
},
"types": "./types/isFunction.d.ts",
"browser": "./dist/es/isFunction.production.js",
"umd": "./dist/umd/isFunction.production.js",
"import": "./dist/es/isFunction.production.js",
"require": "./dist/cjs/isFunction.production.js",
"node": "./dist/cjs/isFunction.production.js",
"module": "./dist/es/isFunction.production.js",
"default": "./dist/cjs/isFunction.production.js"
},
"./isNullish": {
"production": {
"types": "./types/isNullish.d.ts",
"browser": "./dist/es/isNullish.production.js",
"umd": "./dist/umd/isNullish.production.js",
"import": "./dist/es/isNullish.production.js",
"require": "./dist/cjs/isNullish.production.js",
"node": "./dist/cjs/isNullish.production.js",
"module": "./dist/es/isNullish.production.js",
"default": "./dist/cjs/isNullish.production.js"
},
"development": {
"types": "./types/isNullish.d.ts",
"browser": "./dist/es/isNullish.development.js",
"umd": "./dist/umd/isNullish.development.js",
"import": "./dist/es/isNullish.development.js",
"require": "./dist/cjs/isNullish.development.js",
"node": "./dist/cjs/isNullish.development.js",
"module": "./dist/es/isNullish.development.js",
"default": "./dist/cjs/isNullish.development.js"
},
"types": "./types/isNullish.d.ts",
"browser": "./dist/es/isNullish.production.js",
"umd": "./dist/umd/isNullish.production.js",
"import": "./dist/es/isNullish.production.js",
"require": "./dist/cjs/isNullish.production.js",
"node": "./dist/cjs/isNullish.production.js",
"module": "./dist/es/isNullish.production.js",
"default": "./dist/cjs/isNullish.production.js"
},
"./isPromise": {
"production": {
"types": "./types/isPromise.d.ts",
"browser": "./dist/es/isPromise.production.js",
"umd": "./dist/umd/isPromise.production.js",
"import": "./dist/es/isPromise.production.js",
"require": "./dist/cjs/isPromise.production.js",
"node": "./dist/cjs/isPromise.production.js",
"module": "./dist/es/isPromise.production.js",
"default": "./dist/cjs/isPromise.production.js"
},
"development": {
"types": "./types/isPromise.d.ts",
"browser": "./dist/es/isPromise.development.js",
"umd": "./dist/umd/isPromise.development.js",
"import": "./dist/es/isPromise.development.js",
"require": "./dist/cjs/isPromise.development.js",
"node": "./dist/cjs/isPromise.development.js",
"module": "./dist/es/isPromise.development.js",
"default": "./dist/cjs/isPromise.development.js"
},
"types": "./types/isPromise.d.ts",
"browser": "./dist/es/isPromise.production.js",
"umd": "./dist/umd/isPromise.production.js",
"import": "./dist/es/isPromise.production.js",
"require": "./dist/cjs/isPromise.production.js",
"node": "./dist/cjs/isPromise.production.js",
"module": "./dist/es/isPromise.production.js",
"default": "./dist/cjs/isPromise.production.js"
},
"./isStringValue": {
"production": {
"types": "./types/isStringValue.d.ts",
"browser": "./dist/es/isStringValue.production.js",
"umd": "./dist/umd/isStringValue.production.js",
"import": "./dist/es/isStringValue.production.js",
"require": "./dist/cjs/isStringValue.production.js",
"node": "./dist/cjs/isStringValue.production.js",
"module": "./dist/es/isStringValue.production.js",
"default": "./dist/cjs/isStringValue.production.js"
},
"development": {
"types": "./types/isStringValue.d.ts",
"browser": "./dist/es/isStringValue.development.js",
"umd": "./dist/umd/isStringValue.development.js",
"import": "./dist/es/isStringValue.development.js",
"require": "./dist/cjs/isStringValue.development.js",
"node": "./dist/cjs/isStringValue.development.js",
"module": "./dist/es/isStringValue.development.js",
"default": "./dist/cjs/isStringValue.development.js"
},
"types": "./types/isStringValue.d.ts",
"browser": "./dist/es/isStringValue.production.js",
"umd": "./dist/umd/isStringValue.production.js",
"import": "./dist/es/isStringValue.production.js",
"require": "./dist/cjs/isStringValue.production.js",
"node": "./dist/cjs/isStringValue.production.js",
"module": "./dist/es/isStringValue.production.js",
"default": "./dist/cjs/isStringValue.production.js"
},
"./last": {
"production": {
"types": "./types/last.d.ts",
"browser": "./dist/es/last.production.js",
"umd": "./dist/umd/last.production.js",
"import": "./dist/es/last.production.js",
"require": "./dist/cjs/last.production.js",
"node": "./dist/cjs/last.production.js",
"module": "./dist/es/last.production.js",
"default": "./dist/cjs/last.production.js"
},
"development": {
"types": "./types/last.d.ts",
"browser": "./dist/es/last.development.js",
"umd": "./dist/umd/last.development.js",
"import": "./dist/es/last.development.js",
"require": "./dist/cjs/last.development.js",
"node": "./dist/cjs/last.development.js",
"module": "./dist/es/last.development.js",
"default": "./dist/cjs/last.development.js"
},
"types": "./types/last.d.ts",
"browser": "./dist/es/last.production.js",
"umd": "./dist/umd/last.production.js",
"import": "./dist/es/last.production.js",
"require": "./dist/cjs/last.production.js",
"node": "./dist/cjs/last.production.js",
"module": "./dist/es/last.production.js",
"default": "./dist/cjs/last.production.js"
},
"./mapFirst": {
"production": {
"types": "./types/mapFirst.d.ts",
"browser": "./dist/es/mapFirst.production.js",
"umd": "./dist/umd/mapFirst.production.js",
"import": "./dist/es/mapFirst.production.js",
"require": "./dist/cjs/mapFirst.production.js",
"node": "./dist/cjs/mapFirst.production.js",
"module": "./dist/es/mapFirst.production.js",
"default": "./dist/cjs/mapFirst.production.js"
},
"development": {
"types": "./types/mapFirst.d.ts",
"browser": "./dist/es/mapFirst.development.js",
"umd": "./dist/umd/mapFirst.development.js",
"import": "./dist/es/mapFirst.development.js",
"require": "./dist/cjs/mapFirst.development.js",
"node": "./dist/cjs/mapFirst.development.js",
"module": "./dist/es/mapFirst.development.js",
"default": "./dist/cjs/mapFirst.development.js"
},
"types": "./types/mapFirst.d.ts",
"browser": "./dist/es/mapFirst.production.js",
"umd": "./dist/umd/mapFirst.production.js",
"import": "./dist/es/mapFirst.production.js",
"require": "./dist/cjs/mapFirst.production.js",
"node": "./dist/cjs/mapFirst.production.js",
"module": "./dist/es/mapFirst.production.js",
"default": "./dist/cjs/mapFirst.production.js"
},
"./nestedArray": {
"production": {
"types": "./types/nestedArray.d.ts",
"browser": "./dist/es/nestedArray.production.js",
"umd": "./dist/umd/nestedArray.production.js",
"import": "./dist/es/nestedArray.production.js",
"require": "./dist/cjs/nestedArray.production.js",
"node": "./dist/cjs/nestedArray.production.js",
"module": "./dist/es/nestedArray.production.js",
"default": "./dist/cjs/nestedArray.production.js"
},
"development": {
"types": "./types/nestedArray.d.ts",
"browser": "./dist/es/nestedArray.development.js",
"umd": "./dist/umd/nestedArray.development.js",
"import": "./dist/es/nestedArray.development.js",
"require": "./dist/cjs/nestedArray.development.js",
"node": "./dist/cjs/nestedArray.development.js",
"module": "./dist/es/nestedArray.development.js",
"default": "./dist/cjs/nestedArray.development.js"
},
"types": "./types/nestedArray.d.ts",
"browser": "./dist/es/nestedArray.production.js",
"umd": "./dist/umd/nestedArray.production.js",
"import": "./dist/es/nestedArray.production.js",
"require": "./dist/cjs/nestedArray.production.js",
"node": "./dist/cjs/nestedArray.production.js",
"module": "./dist/es/nestedArray.production.js",
"default": "./dist/cjs/nestedArray.production.js"
},
"./optionalFunctionValue": {
"production": {
"types": "./types/optionalFunctionValue.d.ts",
"browser": "./dist/es/optionalFunctionValue.production.js",
"umd": "./dist/umd/optionalFunctionValue.production.js",
"import": "./dist/es/optionalFunctionValue.production.js",
"require": "./dist/cjs/optionalFunctionValue.production.js",
"node": "./dist/cjs/optionalFunctionValue.production.js",
"module": "./dist/es/optionalFunctionValue.production.js",
"default": "./dist/cjs/optionalFunctionValue.production.js"
},
"development": {
"types": "./types/optionalFunctionValue.d.ts",
"browser": "./dist/es/optionalFunctionValue.development.js",
"umd": "./dist/umd/optionalFunctionValue.development.js",
"import": "./dist/es/optionalFunctionValue.development.js",
"require": "./dist/cjs/optionalFunctionValue.development.js",
"node": "./dist/cjs/optionalFunctionValue.development.js",
"module": "./dist/es/optionalFunctionValue.development.js",
"default": "./dist/cjs/optionalFunctionValue.development.js"
},
"types": "./types/optionalFunctionValue.d.ts",
"browser": "./dist/es/optionalFunctionValue.production.js",
"umd": "./dist/umd/optionalFunctionValue.production.js",
"import": "./dist/es/optionalFunctionValue.production.js",
"require": "./dist/cjs/optionalFunctionValue.production.js",
"node": "./dist/cjs/optionalFunctionValue.production.js",
"module": "./dist/es/optionalFunctionValue.production.js",
"default": "./dist/cjs/optionalFunctionValue.production.js"
},
"./partition": {
"production": {
"types": "./types/partition.d.ts",
"browser": "./dist/es/partition.production.js",
"umd": "./dist/umd/partition.production.js",
"import": "./dist/es/partition.production.js",
"require": "./dist/cjs/partition.production.js",
"node": "./dist/cjs/partition.production.js",
"module": "./dist/es/partition.production.js",
"default": "./dist/cjs/partition.production.js"
},
"development": {
"types": "./types/partition.d.ts",
"browser": "./dist/es/partition.development.js",
"umd": "./dist/umd/partition.development.js",
"import": "./dist/es/partition.development.js",
"require": "./dist/cjs/partition.development.js",
"node": "./dist/cjs/partition.development.js",
"module": "./dist/es/partition.development.js",
"default": "./dist/cjs/partition.development.js"
},
"types": "./types/partition.d.ts",
"browser": "./dist/es/partition.production.js",
"umd": "./dist/umd/partition.production.js",
"import": "./dist/es/partition.production.js",
"require": "./dist/cjs/partition.production.js",
"node": "./dist/cjs/partition.production.js",
"module": "./dist/es/partition.production.js",
"default": "./dist/cjs/partition.production.js"
},
"./throwError": {
"production": {
"types": "./types/throwError.d.ts",
"browser": "./dist/es/throwError.production.js",
"umd": "./dist/umd/throwError.production.js",
"import": "./dist/es/throwError.production.js",
"require": "./dist/cjs/throwError.production.js",
"node": "./dist/cjs/throwError.production.js",
"module": "./dist/es/throwError.production.js",
"default": "./dist/cjs/throwError.production.js"
},
"development": {
"types": "./types/throwError.d.ts",
"browser": "./dist/es/throwError.development.js",
"umd": "./dist/umd/throwError.development.js",
"import": "./dist/es/throwError.development.js",
"require": "./dist/cjs/throwError.development.js",
"node": "./dist/cjs/throwError.development.js",
"module": "./dist/es/throwError.development.js",
"default": "./dist/cjs/throwError.development.js"
},
"types": "./types/throwError.d.ts",
"browser": "./dist/es/throwError.production.js",
"umd": "./dist/umd/throwError.production.js",
"import": "./dist/es/throwError.production.js",
"require": "./dist/cjs/throwError.production.js",
"node": "./dist/cjs/throwError.production.js",
"module": "./dist/es/throwError.production.js",
"default": "./dist/cjs/throwError.production.js"
},
".": {

@@ -684,0 +26,0 @@ "development": {

@@ -1,3 +0,3 @@

declare var __DEV__: boolean;
declare var __LIB_VERSION__: string;
declare var LIBRARY_NAME: string;
declare const __DEV__: boolean;
declare const __LIB_VERSION__: string;
declare const LIBRARY_NAME: string;

@@ -7,4 +7,4 @@ export type DropFirst<T extends unknown[]> = T extends [unknown, ...infer U]

export type CB = (...args: any[]) => void;
export type CB = (...args: any[]) => any;
export type ValueOf<T> = T[keyof T];
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true
"declarationMap": true,
"declarationDir": "./types",
"outDir": "./dist"
}
}

@@ -1,1 +0,92 @@

export {};
/**
* Creates a cache function
*/
declare function createCache(maxSize?: number): {
<T>(deps: unknown[], cacheAction: (...args: unknown[]) => T): T;
get(deps: unknown[]): any;
invalidate(item: any): void;
};
declare function isNullish(value: any): value is null | undefined;
declare const isNotNullish: (value: any) => boolean;
declare namespace nestedArray {
type NestedArray<T> = Array<NestedArray<T> | T>;
// This is kind of a map/filter in one function.
// Normally, behaves like a nested-array map,
// but returning `null` will drop the element from the array
function transform<T>(array: NestedArray<T>, cb: (value: T) => NestedArray<T> | T | null): NestedArray<T>;
function valueAtPath<T>(array: NestedArray<T>, path: number[]): T | NestedArray<T>;
function setValueAtPath<T>(array: NestedArray<T>, path: number[], value: NestedArray<T> | T): NestedArray<T>;
function flatten<T>(values: NestedArray<T> | T): T[];
function getCurrent<T>(array: NestedArray<T>, path: number[]): NestedArray<T>;
}
declare function asArray<T>(possibleArg: T | T[]): T[];
type Stringable = string | ((...args: any[]) => string);
type CB = (...args: any[]) => any;
declare function callEach(arr: CB[]): void;
/**
* A safe hasOwnProperty access
*/
declare function hasOwnProperty<T>(obj: T, key: string | number | symbol): key is keyof T;
declare function isPromise(value: any): value is Promise<unknown>;
declare function optionalFunctionValue<T>(value: T | ((...args: any[]) => T), ...args: unknown[]): T;
declare const _default: {
<T extends {}, U>(target: T, source: U): T & U;
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
(target: object, ...sources: any[]): any;
};
declare function defaultTo<T>(value: T | ((...args: any[]) => T), defaultValue: T | (() => T)): T;
declare function invariant(condition: any,
// eslint-disable-next-line @typescript-eslint/ban-types
message?: String | Stringable): asserts condition;
// eslint-disable-next-line @typescript-eslint/ban-types
declare function StringObject(value?: Stringable): String;
declare function isStringValue(v: unknown): v is string;
declare function bindNot<T extends (...args: any[]) => unknown>(fn: T): (...args: Parameters<T>) => boolean;
declare function either(a: unknown, b: unknown): boolean;
declare function isBoolean(value: unknown): value is boolean;
declare function last<T>(values: T | T[]): T;
declare function deferThrow(message?: string): void;
declare namespace bus {
type DropFirst<T extends unknown[]> = T extends [
unknown,
...infer U
] ? U : never;
type Stringable = string | ((...args: any[]) => string);
type CB = (...args: any[]) => any;
type ValueOf<T> = T[keyof T];
function createBus(): {
on: (event: string, handler: CB) => OnReturn;
emit: (event: string, ...args: any[]) => void;
};
type OnReturn = {
off: () => void;
};
}
/**
* @returns a unique numeric id.
*/
declare const seq: () => string;
declare function isFunction(value: unknown): value is (...args: unknown[]) => unknown;
declare function mapFirst<T>(array: T[], callback: (item: T, breakout: (conditional: boolean, value: unknown) => void, index: number) => unknown): any;
declare function greaterThan(value: number | string, gt: number | string): boolean;
declare function longerThan(value: string | unknown[], arg1: string | number): boolean;
declare function isNumeric(value: string | number): boolean;
declare const isNotNumeric: (value: string | number) => boolean;
declare function lengthEquals(value: string | unknown[], arg1: string | number): boolean;
declare const lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
declare function numberEquals(value: string | number, eq: string | number): boolean;
declare const numberNotEquals: (value: string | number, eq: string | number) => boolean;
declare function isNull(value: unknown): value is null;
declare const isNotNull: (value: unknown) => boolean;
declare function isUndefined(value?: unknown): value is undefined;
declare const isNotUndefined: (value?: unknown) => boolean;
// The module is named "isArrayValue" since it
// is conflicting with a nested npm dependency.
// We may need to revisit this in the future.
declare function isArray(value: unknown): value is Array<unknown>;
declare const isNotArray: (value: unknown) => boolean;
declare function isEmpty(value: unknown): boolean;
declare const isNotEmpty: (value: unknown) => boolean;
declare function isPositive(value: number | string): boolean;
export { createCache as cache, isNullish, isNotNullish, nestedArray, asArray, callEach, hasOwnProperty, isPromise, optionalFunctionValue, _default as assign, defaultTo, invariant, StringObject, isStringValue, bindNot, either, isBoolean, last, deferThrow, bus, seq, isFunction, mapFirst, greaterThan, longerThan, isNumeric, isNotNumeric, lengthEquals, lengthNotEquals, numberEquals, numberNotEquals, isNull, isNotNull, isUndefined, isNotUndefined, isArray, isNotArray, isEmpty, isNotEmpty, isPositive };
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