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

@livechat/data-utils

Package Overview
Dependencies
Maintainers
9
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@livechat/data-utils - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

29

dist/data-utils.es.js

@@ -785,3 +785,30 @@ /**

}
return deepMerge({}, objA, objB);
var result = {};
forOwn(function (value, key) {
if (hasOwn(key, objB)) {
if (isObject(objA[key]) && isObject(objB[key])) {
result[key] = merge(objA[key], objB[key]);
} else if (isArray(objA[key]) && isArray(objB[key])) {
var length = Math.max(objA[key].length, objB[key].length);
result[key] = new Array(length);
for (var i = 0; i < length; i++) {
if (i in objB[key]) {
result[key][i] = objB[key][i];
} else if (i in objA[key]) {
result[key][i] = objA[key][i];
}
}
} else {
result[key] = objB[key];
}
} else {
result[key] = objA[key];
}
}, objA);
forOwn(function (value, key) {
if (!hasOwn(key, result)) {
result[key] = objB[key];
}
}, objB);
return result;
}

@@ -788,0 +815,0 @@

@@ -789,3 +789,30 @@ 'use strict';

}
return deepMerge({}, objA, objB);
var result = {};
forOwn(function (value, key) {
if (hasOwn(key, objB)) {
if (isObject(objA[key]) && isObject(objB[key])) {
result[key] = merge(objA[key], objB[key]);
} else if (isArray(objA[key]) && isArray(objB[key])) {
var length = Math.max(objA[key].length, objB[key].length);
result[key] = new Array(length);
for (var i = 0; i < length; i++) {
if (i in objB[key]) {
result[key][i] = objB[key][i];
} else if (i in objA[key]) {
result[key][i] = objA[key][i];
}
}
} else {
result[key] = objB[key];
}
} else {
result[key] = objA[key];
}
}, objA);
forOwn(function (value, key) {
if (!hasOwn(key, result)) {
result[key] = objB[key];
}
}, objB);
return result;
}

@@ -792,0 +819,0 @@

@@ -791,3 +791,30 @@ (function (global, factory) {

}
return deepMerge({}, objA, objB);
var result = {};
forOwn(function (value, key) {
if (hasOwn(key, objB)) {
if (isObject(objA[key]) && isObject(objB[key])) {
result[key] = merge(objA[key], objB[key]);
} else if (isArray(objA[key]) && isArray(objB[key])) {
var length = Math.max(objA[key].length, objB[key].length);
result[key] = new Array(length);
for (var i = 0; i < length; i++) {
if (i in objB[key]) {
result[key][i] = objB[key][i];
} else if (i in objA[key]) {
result[key][i] = objA[key][i];
}
}
} else {
result[key] = objB[key];
}
} else {
result[key] = objA[key];
}
}, objA);
forOwn(function (value, key) {
if (!hasOwn(key, result)) {
result[key] = objB[key];
}
}, objB);
return result;
}

@@ -794,0 +821,0 @@

2

dist/data-utils.umd.min.js

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

!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((n="undefined"!=typeof globalThis?globalThis:n||self).DataUtils={})}(this,(function(n){"use strict";function r(n,r){return n+r}var t={}.hasOwnProperty;function e(n,r){return t.call(r,n)}function u(){return(u=Object.assign||function(n){for(var r=arguments.length,t=Array(r>1?r-1:0),u=1;r>u;u++)t[u-1]=arguments[u];return t.forEach((function(r){for(var t in r)e(t,r)&&(n[t]=r[t])})),n}).apply(void 0,arguments)}function o(n,r){var t;return(t=[]).concat.apply(t,r.map(n))}function i(n){return Array.isArray(n)}function c(n){return"object"==typeof n&&null!==n&&!i(n)}function f(n){if("keys"in Object&&"function"==typeof Object.keys)return Object.keys(n);var r=[];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&r.push(t);return r}function a(n,r){return f(r).reduce((function(t,e){return t[e]=n(r[e]),t}),{})}function l(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;r>e;e++)t[e-1]=arguments[e];if(!t.length)return n;var u=t.shift();if(c(n)&&c(u))for(var o in u){var i,f;if(c(u[o]))n[o]||Object.assign(n,((i={})[o]={},i)),l(n[o],u[o]);else Object.assign(n,((f={})[o]=u[o],f))}return l.apply(void 0,[n].concat(t))}function s(n){return null==n}function p(n,r){for(var t=0;r.length>t;t++){var e=r[t];if(n(e))return e}}function d(n,r,t){for(var e=r;e>=0;e--)if(n(t[e]))return e;return-1}function v(n){return n}function y(){return Math.random().toString(36).substring(2)}function h(n,r){for(var t="string"==typeof n?n.split("."):n,e=0,u=r;u&&t.length>e;)u=u[t[e++]];return u}function g(n){return 0===(i(n)?n:Object.keys(n)).length}function m(n,r){return g(r)?n:l({},n,r)}function b(n,r){var t={};return function(){var u=n.apply(void 0,arguments);if(e(u,t))return t[u];var o=r.apply(void 0,arguments);return t[u]=o,o}}function O(n){return f(n).map((function(r){return n[r]}))}function A(n,r){return f(r).reduce((function(t,e){return n(r[e],e)||(t[e]=r[e]),t}),{})}function j(n,r){return r.slice(-n)}function w(n,r){return[n,r]}function k(n,r){return f(r).reduce((function(t,e){return n(r[e],e)&&(t[e]=r[e]),t}),{})}function x(n,r){return n+Math.floor(Math.random()*(r-n+1))}function C(){return(C=Object.assign?Object.assign.bind():function(n){for(var r=1;arguments.length>r;r++){var t=arguments[r];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])}return n}).apply(this,arguments)}function T(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=Array(r);r>t;t++)e[t]=n[t];return e}function N(n,r){var t="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(t)return(t=t.call(n)).next.bind(t);if(Array.isArray(n)||(t=function(n,r){if(n){if("string"==typeof n)return T(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?T(n,r):void 0}}(n))||r&&n&&"number"==typeof n.length){t&&(n=t);var e=0;return function(){return n.length>e?{done:!1,value:n[e++]}:{done:!0}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(n,r){return n===r?0!==n||0!==r||1/n==1/r:n!=n&&r!=r}function I(n,r){return[r.slice(0,n),r.slice(n,r.length)]}function L(n,r,t){var e=d((function(r){return!n(r)}),r,t);return e===r?[]:t.slice(e+1,r+1)}var z=/^\s+/;var B=/\s+$/;function M(n,r){var t=[];return r.filter((function(r){var e=n(r);return-1===t.indexOf(e)&&(t.push(e),!0)}))}function P(n,r,t){return r.map((function(r,e){return n(r,t[e])}))}n.add=r,n.assign=u,n.camelCase=function(n){var r=n.trim();return 0===r.length?"":1===r.length?r.toLowerCase():/^[a-z\d]+$/.test(r)?r:(r!==r.toLowerCase()&&(r=function(n){for(var r=n,t=!1,e=!1,u=!1,o=0;r.length>o;o++){var i=r[o];t&&/[a-zA-Z]/.test(i)&&i.toUpperCase()===i?(r=r.slice(0,o)+"-"+r.slice(o),t=!1,u=e,e=!0,o++):e&&u&&/[a-zA-Z]/.test(i)&&i.toLowerCase()===i?(r=r.slice(0,o-1)+"-"+r.slice(o-1),u=e,e=!1,t=!0):(t=i.toLowerCase()===i,u=e,e=i.toUpperCase()===i)}return r}(r)),r=r.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(function(n,r){return r.toUpperCase()})))},n.capitalizeFirstLetter=function(n){return n.charAt(0).toUpperCase()+n.slice(1)},n.chain=function(n,r){return"function"==typeof r?function(t){return n(r(t))(t)}:o(n,r)},n.chunk=function(n,r){if(0>=r)return[];for(var t=[],e=0;n.length>e;e+=r)t.push(n.slice(e,e+r));return t},n.cloneDeep=function n(r){return i(r)?r.map(n):c(r)?a(n,r):r},n.compact=function(n){return i(n)?n.filter((function(n){return null!=n&&!Number.isNaN(n)})):Object.keys(n).reduce((function(r,t){var e=n[t];return null==e||Number.isNaN(e)||(r[t]=e),r}),{})},n.compose=function(){for(var n=arguments.length,r=Array(n),t=0;n>t;t++)r[t]=arguments[t];return r.reduce((function(n,r){return function(){return n(r.apply(void 0,arguments))}}))},n.debounce=function(n,r){var t;return function(){clearTimeout(t);for(var e=arguments.length,u=Array(e),o=0;e>o;o++)u[o]=arguments[o];t=setTimeout.apply(void 0,[r,n].concat(u))}},n.deepMapKeys=function n(r,t){return Object.keys(t).reduce((function(e,u){return t[u]&&"object"==typeof t[u]?Array.isArray(t[u])?(e[r(u)]=t[u].map((function(t){return n(r,t)})),e):(e[r(u)]=n(r,t[u]),e):(e[r(u)]=t[u],e)}),{})},n.deepMerge=l,n.defaultTo=function(n){return function(r){return s(r)?n:r}},n.diffKeys=function(n,r){return f(n).reduce((function(t,e){return n[e]!==r[e]&&t.push(e),t}),[])},n.drop=function(n,r){return r.slice(n)},n.dropRight=function(n,r){return r.slice(0,-n)},n.ensureArray=function(n){return i(n)?n:[n]},n.entries=function(n){return f(n).map((function(r){return[r,n[r]]}))},n.filledArray=function(n,r){if(0>=n)return[];for(var t=[];n--;)t.push(r);return t},n.find=p,n.findIndex=function(n,r){for(var t=0;r.length>t;t++)if(n(r[t]))return t;return-1},n.findKey=function(n,r){return p((function(t){return n(r[t])}),f(r))},n.findLast=function(n,r){for(var t=r.length-1;t>=0;t--)if(n(r[t]))return r[t]},n.findLastIndex=function(n,r){return d(n,r.length-1,r)},n.findLastIndexFrom=d,n.flatMap=o,n.flatten=function(n){return o(v,n)},n.forOwn=function(n,r){return f(r).forEach((function(t){n(r[t],t)}))},n.fromPairs=function(n){return n.reduce((function(n,r){return n[r[0]]=r[1],n}),{})},n.generateRandomId=y,n.generateUniqueId=function n(r){var t=y();return e(t,r)?n(r):t},n.get=h,n.getOr=function(n,r,t){var e=h(r,t);return null!=e?e:n},n.groupBy=function(n,r){return Object.keys(r).reduce((function(t,e){var u=r[e],o=n(u);return t[o]=t[o]||[],t[o].push(u),t}),{})},n.groupKeys=function(n,r){return f(r).reduce((function(t,e){var u=n(e);return t[u]=t[u]||{},t[u][e]=r[e],t}),{})},n.hasOwn=e,n.identity=v,n.includes=function(n,r){return-1!==r.indexOf(n)},n.isArray=i,n.isEmpty=g,n.isFalsy=function(n){return!n},n.isNil=s,n.isObject=c,n.isPromise=function(n){return!!n&&"function"==typeof n.then},n.isTruthy=function(n){return!!n},n.keyBy=function(n,r){return r.reduce((function(r,t){return r[t[n]]=t,r}),{})},n.keys=f,n.last=function(n){return n.length>0?n[n.length-1]:void 0},n.leadingThrottle=function(n,r){var t=0;return function(){var e=Date.now();n>e-t||(t=Date.now(),r.apply(void 0,arguments))}},n.mapKeys=function(n,r){return f(r).reduce((function(t,e){return Object.defineProperty(t,n(e),{value:r[e],enumerable:!0}),t}),{})},n.mapValues=a,n.mapValuesIndexed=function(n,r){return f(r).reduce((function(t,e){return t[e]=n(r[e],e),t}),{})},n.memoize=function(n){return b(v,n)},n.memoizeOne=function(n){var r,t,e=!1;return function(){return e&&(arguments.length>0?arguments[0]:void 0)===t?r:(e=!0,t=arguments.length>0?arguments[0]:void 0,r=n.apply(void 0,arguments))}},n.memoizeWith=b,n.merge=m,n.mergeAll=function(n){if(0===n.length)return{};var r=n[0];return n.slice(1).reduce((function(n,r){return m(n,r)}),r)},n.noop=function(){},n.numericSortBy=function(n,r){var t="function"==typeof n?n:function(r){return h(n,r)};return(i(r)?[].concat(r):O(r)).sort((function(n,r){return t(n)-t(r)}))},n.omit=function(n,r){return A((function(r,t){return-1!==n.indexOf(t)}),r)},n.omitBy=function(n,r){return f(r).reduce((function(t,e){return n(r[e])||(t[e]=r[e]),t}),{})},n.omitByIndexed=A,n.once=function(n){var r,t=!1;return function(){return t?r:(t=!0,r=n.apply(void 0,arguments))}},n.over=function(n){return function(){for(var r=arguments.length,t=Array(r),e=0;r>e;e++)t[e]=arguments[e];return n.map((function(n){return n.apply(void 0,t)}))}},n.overArgs=function(n,r){return function(){for(var t=arguments.length,e=Array(t),u=0;t>u;u++)e[u]=arguments[u];var o=r.map((function(n,r){return n(e[r])}));return n.apply(void 0,e.length>o.length?o.concat(j(e.length-o.length,e)):o)}},n.pair=w,n.partitionObject=function(n,r){return f(r).reduce((function(t,e){return t[n(r[e])?0:1][e]=r[e],t}),[{},{}])},n.pick=function(n,r){return n.reduce((function(n,t){return n[t]=r[t],n}),{})},n.pickBy=function(n,r){return f(r).reduce((function(t,e){return n(r[e])&&(t[e]=r[e]),t}),{})},n.pickByIndexed=k,n.pickOwn=function(n,r){return n.reduce((function(n,t){return e(t,r)&&(n[t]=r[t]),n}),{})},n.randomInt=x,n.range=function(n){for(var r=[],t=0;n>=t;)r.push(t++);return r},n.reject=function(n,r){return r.filter((function(r){return!n(r)}))},n.removeAt=function(n,r){var t=[].concat(r);return t.splice(n,1),t},n.repeat=function(n,r){return Array(n+1).join(r)},n.set=function n(r,t,u){var o,c=i(r)?r:r.split("."),f=c[0],a=t;if(c.length>1){var l=null!=u&&e(f,u)?u[f]:{};a=n(c.slice(1),t,l)}return C({},u,((o={})[f]=a,o))},n.shallowEqual=function(n,r){if(D(n,r))return!0;if("object"!=typeof n||null===n||"object"!=typeof r||null===r)return!1;var t=Object.keys(n);if(t.length!==Object.keys(r).length)return!1;for(var u=0;t.length>u;u++)if(!e(t[u],r)||!D(n[t[u]],r[t[u]]))return!1;return!0},n.shortenLongText=function(n,r){if(n>=r.length)return r;for(var t,e=[],u=0,o=N(r.split(" "));!(t=o()).done;){var i=t.value;if(u+i.length>n)break;u+=i.length+1,e.push(i)}return e.join(" ")+"..."},n.shuffle=function(n){for(var r=n.slice(),t=n.length-1,e=0;n.length>e;e++){var u=x(e,t),o=r[u];r[u]=r[e],r[e]=o}return r},n.sign=function(n){return"number"!=typeof n||isNaN(n)?NaN:Object.is(n,0)?0:Object.is(n,-0)?-0:n>0?1:-1},n.sliceDiff=function(n,r){var t=k((function(n,t){return n!==r[t]}),n);return g(t)?null:t},n.snakeCase=function(n){var r=n.replace(/[A-Z]|([-_ ]+)/g,(function(n){var r=n.charCodeAt(0);return r>64&&91>r?"_"+n.toLowerCase():"_"}));return"_"===r[0]?r.substr(1):r},n.someAreTruthy=function(n){return n.some(v)},n.splitAt=I,n.splitRightWhenAccum=function(n,r,t){for(var e=t.length;e>0;e--){var u=n(t[e-1],r);if(r=u[1],u[0])return I(e-1,t)}return[[],t]},n.spread=function(n){return function(r){return n.apply(void 0,r)}},n.stringCompare=function(n,r){return n===r?0:r>n?-1:1},n.sum=function(n){return n.reduce(r,0)},n.take=function(n,r){return r.slice(0,n)},n.takeLast=j,n.takeRightWhile=function(n,r){return L(n,r.length-1,r)},n.takeRightWhileFrom=L,n.throttle=function(n,r){var t,e=Date.now()-2*n,u=function(){e=Date.now(),r.apply(void 0,arguments)},o=function(){return clearTimeout(t)},i=function(){for(var r=Date.now(),i=arguments.length,c=Array(i),f=0;i>f;f++)c[f]=arguments[f];n>r-e?(o(),t=setTimeout.apply(void 0,[u,e-r+n].concat(c))):u.apply(void 0,c)};return i.cancel=o,i},n.toArray=function(n){return Array.prototype.slice.call(n)},n.toFixedNumber=function(n,r){return Number(n.toFixed(r))},n.toPairs=function(n){return f(n).map((function(r){return[r,n[r]]}))},n.trailingThrottle=function(n,r){var t,e=Date.now()-2*n,u=function(){return e=Date.now(),r.apply(void 0,arguments)},o=function(){return clearTimeout(t)},i=function(){var r=Date.now();n>r-e||(e=Date.now()),o();for(var i=arguments.length,c=Array(i),f=0;i>f;f++)c[f]=arguments[f];t=setTimeout.apply(void 0,[u,e-r+n].concat(c))};return i.cancel=o,i},n.trimEnd=function(n){return n.replace(B,"")},n.trimStart=function(n){return n.replace(z,"")},n.uniq=function(n){return M(v,n)},n.uniqBy=M,n.update=function(n,r,t){return[].concat(t.slice(0,n),[r],t.slice(n+1,t.length))},n.values=O,n.without=function(n,r){return r.filter((function(r){return-1===n.indexOf(r)}))},n.zip=function(n,r){return P(w,n,r)},n.zipWith=P,Object.defineProperty(n,"__esModule",{value:!0})}));
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((n="undefined"!=typeof globalThis?globalThis:n||self).DataUtils={})}(this,(function(n){"use strict";function r(n,r){return n+r}var t={}.hasOwnProperty;function e(n,r){return t.call(r,n)}function u(){return(u=Object.assign||function(n){for(var r=arguments.length,t=Array(r>1?r-1:0),u=1;r>u;u++)t[u-1]=arguments[u];return t.forEach((function(r){for(var t in r)e(t,r)&&(n[t]=r[t])})),n}).apply(void 0,arguments)}function o(n,r){var t;return(t=[]).concat.apply(t,r.map(n))}function i(n){return Array.isArray(n)}function c(n){return"object"==typeof n&&null!==n&&!i(n)}function f(n){if("keys"in Object&&"function"==typeof Object.keys)return Object.keys(n);var r=[];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&r.push(t);return r}function a(n,r){return f(r).reduce((function(t,e){return t[e]=n(r[e]),t}),{})}function l(n){return null==n}function s(n,r){for(var t=0;r.length>t;t++){var e=r[t];if(n(e))return e}}function p(n,r,t){for(var e=r;e>=0;e--)if(n(t[e]))return e;return-1}function d(n){return n}function v(n,r){return f(r).forEach((function(t){n(r[t],t)}))}function y(){return Math.random().toString(36).substring(2)}function h(n,r){for(var t="string"==typeof n?n.split("."):n,e=0,u=r;u&&t.length>e;)u=u[t[e++]];return u}function g(n){return 0===(i(n)?n:Object.keys(n)).length}function m(n,r){if(g(r))return n;var t={};return v((function(u,o){if(e(o,r))if(c(n[o])&&c(r[o]))t[o]=m(n[o],r[o]);else if(i(n[o])&&i(r[o])){var f=Math.max(n[o].length,r[o].length);t[o]=Array(f);for(var a=0;f>a;a++)a in r[o]?t[o][a]=r[o][a]:a in n[o]&&(t[o][a]=n[o][a])}else t[o]=r[o];else t[o]=n[o]}),n),v((function(n,u){e(u,t)||(t[u]=r[u])}),r),t}function b(n,r){var t={};return function(){var u=n.apply(void 0,arguments);if(e(u,t))return t[u];var o=r.apply(void 0,arguments);return t[u]=o,o}}function A(n){return f(n).map((function(r){return n[r]}))}function O(n,r){return f(r).reduce((function(t,e){return n(r[e],e)||(t[e]=r[e]),t}),{})}function j(n,r){return r.slice(-n)}function w(n,r){return[n,r]}function k(n,r){return f(r).reduce((function(t,e){return n(r[e],e)&&(t[e]=r[e]),t}),{})}function x(n,r){return n+Math.floor(Math.random()*(r-n+1))}function C(){return(C=Object.assign?Object.assign.bind():function(n){for(var r=1;arguments.length>r;r++){var t=arguments[r];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])}return n}).apply(this,arguments)}function T(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=Array(r);r>t;t++)e[t]=n[t];return e}function N(n,r){var t="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(t)return(t=t.call(n)).next.bind(t);if(Array.isArray(n)||(t=function(n,r){if(n){if("string"==typeof n)return T(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?T(n,r):void 0}}(n))||r&&n&&"number"==typeof n.length){t&&(n=t);var e=0;return function(){return n.length>e?{done:!1,value:n[e++]}:{done:!0}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(n,r){return n===r?0!==n||0!==r||1/n==1/r:n!=n&&r!=r}function I(n,r){return[r.slice(0,n),r.slice(n,r.length)]}function L(n,r,t){var e=p((function(r){return!n(r)}),r,t);return e===r?[]:t.slice(e+1,r+1)}var z=/^\s+/;var M=/\s+$/;function B(n,r){var t=[];return r.filter((function(r){var e=n(r);return-1===t.indexOf(e)&&(t.push(e),!0)}))}function P(n,r,t){return r.map((function(r,e){return n(r,t[e])}))}n.add=r,n.assign=u,n.camelCase=function(n){var r=n.trim();return 0===r.length?"":1===r.length?r.toLowerCase():/^[a-z\d]+$/.test(r)?r:(r!==r.toLowerCase()&&(r=function(n){for(var r=n,t=!1,e=!1,u=!1,o=0;r.length>o;o++){var i=r[o];t&&/[a-zA-Z]/.test(i)&&i.toUpperCase()===i?(r=r.slice(0,o)+"-"+r.slice(o),t=!1,u=e,e=!0,o++):e&&u&&/[a-zA-Z]/.test(i)&&i.toLowerCase()===i?(r=r.slice(0,o-1)+"-"+r.slice(o-1),u=e,e=!1,t=!0):(t=i.toLowerCase()===i,u=e,e=i.toUpperCase()===i)}return r}(r)),r=r.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(function(n,r){return r.toUpperCase()})))},n.capitalizeFirstLetter=function(n){return n.charAt(0).toUpperCase()+n.slice(1)},n.chain=function(n,r){return"function"==typeof r?function(t){return n(r(t))(t)}:o(n,r)},n.chunk=function(n,r){if(0>=r)return[];for(var t=[],e=0;n.length>e;e+=r)t.push(n.slice(e,e+r));return t},n.cloneDeep=function n(r){return i(r)?r.map(n):c(r)?a(n,r):r},n.compact=function(n){return i(n)?n.filter((function(n){return null!=n&&!Number.isNaN(n)})):Object.keys(n).reduce((function(r,t){var e=n[t];return null==e||Number.isNaN(e)||(r[t]=e),r}),{})},n.compose=function(){for(var n=arguments.length,r=Array(n),t=0;n>t;t++)r[t]=arguments[t];return r.reduce((function(n,r){return function(){return n(r.apply(void 0,arguments))}}))},n.debounce=function(n,r){var t;return function(){clearTimeout(t);for(var e=arguments.length,u=Array(e),o=0;e>o;o++)u[o]=arguments[o];t=setTimeout.apply(void 0,[r,n].concat(u))}},n.deepMapKeys=function n(r,t){return Object.keys(t).reduce((function(e,u){return t[u]&&"object"==typeof t[u]?Array.isArray(t[u])?(e[r(u)]=t[u].map((function(t){return n(r,t)})),e):(e[r(u)]=n(r,t[u]),e):(e[r(u)]=t[u],e)}),{})},n.deepMerge=function n(r){for(var t=arguments.length,e=Array(t>1?t-1:0),u=1;t>u;u++)e[u-1]=arguments[u];if(!e.length)return r;var o=e.shift();if(c(r)&&c(o))for(var i in o){var f,a;if(c(o[i]))r[i]||Object.assign(r,((f={})[i]={},f)),n(r[i],o[i]);else Object.assign(r,((a={})[i]=o[i],a))}return n.apply(void 0,[r].concat(e))},n.defaultTo=function(n){return function(r){return l(r)?n:r}},n.diffKeys=function(n,r){return f(n).reduce((function(t,e){return n[e]!==r[e]&&t.push(e),t}),[])},n.drop=function(n,r){return r.slice(n)},n.dropRight=function(n,r){return r.slice(0,-n)},n.ensureArray=function(n){return i(n)?n:[n]},n.entries=function(n){return f(n).map((function(r){return[r,n[r]]}))},n.filledArray=function(n,r){if(0>=n)return[];for(var t=[];n--;)t.push(r);return t},n.find=s,n.findIndex=function(n,r){for(var t=0;r.length>t;t++)if(n(r[t]))return t;return-1},n.findKey=function(n,r){return s((function(t){return n(r[t])}),f(r))},n.findLast=function(n,r){for(var t=r.length-1;t>=0;t--)if(n(r[t]))return r[t]},n.findLastIndex=function(n,r){return p(n,r.length-1,r)},n.findLastIndexFrom=p,n.flatMap=o,n.flatten=function(n){return o(d,n)},n.forOwn=v,n.fromPairs=function(n){return n.reduce((function(n,r){return n[r[0]]=r[1],n}),{})},n.generateRandomId=y,n.generateUniqueId=function n(r){var t=y();return e(t,r)?n(r):t},n.get=h,n.getOr=function(n,r,t){var e=h(r,t);return null!=e?e:n},n.groupBy=function(n,r){return Object.keys(r).reduce((function(t,e){var u=r[e],o=n(u);return t[o]=t[o]||[],t[o].push(u),t}),{})},n.groupKeys=function(n,r){return f(r).reduce((function(t,e){var u=n(e);return t[u]=t[u]||{},t[u][e]=r[e],t}),{})},n.hasOwn=e,n.identity=d,n.includes=function(n,r){return-1!==r.indexOf(n)},n.isArray=i,n.isEmpty=g,n.isFalsy=function(n){return!n},n.isNil=l,n.isObject=c,n.isPromise=function(n){return!!n&&"function"==typeof n.then},n.isTruthy=function(n){return!!n},n.keyBy=function(n,r){return r.reduce((function(r,t){return r[t[n]]=t,r}),{})},n.keys=f,n.last=function(n){return n.length>0?n[n.length-1]:void 0},n.leadingThrottle=function(n,r){var t=0;return function(){var e=Date.now();n>e-t||(t=Date.now(),r.apply(void 0,arguments))}},n.mapKeys=function(n,r){return f(r).reduce((function(t,e){return Object.defineProperty(t,n(e),{value:r[e],enumerable:!0}),t}),{})},n.mapValues=a,n.mapValuesIndexed=function(n,r){return f(r).reduce((function(t,e){return t[e]=n(r[e],e),t}),{})},n.memoize=function(n){return b(d,n)},n.memoizeOne=function(n){var r,t,e=!1;return function(){return e&&(arguments.length>0?arguments[0]:void 0)===t?r:(e=!0,t=arguments.length>0?arguments[0]:void 0,r=n.apply(void 0,arguments))}},n.memoizeWith=b,n.merge=m,n.mergeAll=function(n){if(0===n.length)return{};var r=n[0];return n.slice(1).reduce((function(n,r){return m(n,r)}),r)},n.noop=function(){},n.numericSortBy=function(n,r){var t="function"==typeof n?n:function(r){return h(n,r)};return(i(r)?[].concat(r):A(r)).sort((function(n,r){return t(n)-t(r)}))},n.omit=function(n,r){return O((function(r,t){return-1!==n.indexOf(t)}),r)},n.omitBy=function(n,r){return f(r).reduce((function(t,e){return n(r[e])||(t[e]=r[e]),t}),{})},n.omitByIndexed=O,n.once=function(n){var r,t=!1;return function(){return t?r:(t=!0,r=n.apply(void 0,arguments))}},n.over=function(n){return function(){for(var r=arguments.length,t=Array(r),e=0;r>e;e++)t[e]=arguments[e];return n.map((function(n){return n.apply(void 0,t)}))}},n.overArgs=function(n,r){return function(){for(var t=arguments.length,e=Array(t),u=0;t>u;u++)e[u]=arguments[u];var o=r.map((function(n,r){return n(e[r])}));return n.apply(void 0,e.length>o.length?o.concat(j(e.length-o.length,e)):o)}},n.pair=w,n.partitionObject=function(n,r){return f(r).reduce((function(t,e){return t[n(r[e])?0:1][e]=r[e],t}),[{},{}])},n.pick=function(n,r){return n.reduce((function(n,t){return n[t]=r[t],n}),{})},n.pickBy=function(n,r){return f(r).reduce((function(t,e){return n(r[e])&&(t[e]=r[e]),t}),{})},n.pickByIndexed=k,n.pickOwn=function(n,r){return n.reduce((function(n,t){return e(t,r)&&(n[t]=r[t]),n}),{})},n.randomInt=x,n.range=function(n){for(var r=[],t=0;n>=t;)r.push(t++);return r},n.reject=function(n,r){return r.filter((function(r){return!n(r)}))},n.removeAt=function(n,r){var t=[].concat(r);return t.splice(n,1),t},n.repeat=function(n,r){return Array(n+1).join(r)},n.set=function n(r,t,u){var o,c=i(r)?r:r.split("."),f=c[0],a=t;if(c.length>1){var l=null!=u&&e(f,u)?u[f]:{};a=n(c.slice(1),t,l)}return C({},u,((o={})[f]=a,o))},n.shallowEqual=function(n,r){if(D(n,r))return!0;if("object"!=typeof n||null===n||"object"!=typeof r||null===r)return!1;var t=Object.keys(n);if(t.length!==Object.keys(r).length)return!1;for(var u=0;t.length>u;u++)if(!e(t[u],r)||!D(n[t[u]],r[t[u]]))return!1;return!0},n.shortenLongText=function(n,r){if(n>=r.length)return r;for(var t,e=[],u=0,o=N(r.split(" "));!(t=o()).done;){var i=t.value;if(u+i.length>n)break;u+=i.length+1,e.push(i)}return e.join(" ")+"..."},n.shuffle=function(n){for(var r=n.slice(),t=n.length-1,e=0;n.length>e;e++){var u=x(e,t),o=r[u];r[u]=r[e],r[e]=o}return r},n.sign=function(n){return"number"!=typeof n||isNaN(n)?NaN:Object.is(n,0)?0:Object.is(n,-0)?-0:n>0?1:-1},n.sliceDiff=function(n,r){var t=k((function(n,t){return n!==r[t]}),n);return g(t)?null:t},n.snakeCase=function(n){var r=n.replace(/[A-Z]|([-_ ]+)/g,(function(n){var r=n.charCodeAt(0);return r>64&&91>r?"_"+n.toLowerCase():"_"}));return"_"===r[0]?r.substr(1):r},n.someAreTruthy=function(n){return n.some(d)},n.splitAt=I,n.splitRightWhenAccum=function(n,r,t){for(var e=t.length;e>0;e--){var u=n(t[e-1],r);if(r=u[1],u[0])return I(e-1,t)}return[[],t]},n.spread=function(n){return function(r){return n.apply(void 0,r)}},n.stringCompare=function(n,r){return n===r?0:r>n?-1:1},n.sum=function(n){return n.reduce(r,0)},n.take=function(n,r){return r.slice(0,n)},n.takeLast=j,n.takeRightWhile=function(n,r){return L(n,r.length-1,r)},n.takeRightWhileFrom=L,n.throttle=function(n,r){var t,e=Date.now()-2*n,u=function(){e=Date.now(),r.apply(void 0,arguments)},o=function(){return clearTimeout(t)},i=function(){for(var r=Date.now(),i=arguments.length,c=Array(i),f=0;i>f;f++)c[f]=arguments[f];n>r-e?(o(),t=setTimeout.apply(void 0,[u,e-r+n].concat(c))):u.apply(void 0,c)};return i.cancel=o,i},n.toArray=function(n){return Array.prototype.slice.call(n)},n.toFixedNumber=function(n,r){return Number(n.toFixed(r))},n.toPairs=function(n){return f(n).map((function(r){return[r,n[r]]}))},n.trailingThrottle=function(n,r){var t,e=Date.now()-2*n,u=function(){return e=Date.now(),r.apply(void 0,arguments)},o=function(){return clearTimeout(t)},i=function(){var r=Date.now();n>r-e||(e=Date.now()),o();for(var i=arguments.length,c=Array(i),f=0;i>f;f++)c[f]=arguments[f];t=setTimeout.apply(void 0,[u,e-r+n].concat(c))};return i.cancel=o,i},n.trimEnd=function(n){return n.replace(M,"")},n.trimStart=function(n){return n.replace(z,"")},n.uniq=function(n){return B(d,n)},n.uniqBy=B,n.update=function(n,r,t){return[].concat(t.slice(0,n),[r],t.slice(n+1,t.length))},n.values=A,n.without=function(n,r){return r.filter((function(r){return-1===n.indexOf(r)}))},n.zip=function(n,r){return P(w,n,r)},n.zipWith=P,Object.defineProperty(n,"__esModule",{value:!0})}));
{
"name": "@livechat/data-utils",
"version": "1.0.0",
"version": "1.0.1",
"description": "Collection of utility functions",

@@ -5,0 +5,0 @@ "contributors": [

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

import type { AnyObject, Prettify } from './types';
import type { AnyObject } from './types';
/**

@@ -8,3 +8,3 @@ * deep merges the two provided objects

*/
export default function merge<A extends AnyObject, B extends AnyObject>(objA: A, objB: B): Prettify<A & B>;
export default function merge<A extends AnyObject, B extends AnyObject>(objA: A, objB: B): A & B;
//# sourceMappingURL=merge.d.ts.map
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