Socket
Socket
Sign inDemoInstall

chober

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chober - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

4

dist/chober.min.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("_c",[],t):"object"==typeof exports?exports._c=t():e._c=t()}("undefined"==typeof self?this:self,function(){return(n={},o.m=r=[function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},function(e,t,r){var n=r(4),o=r(5),c=r(6);e.exports=function(e){return n(e)||o(e)||c()}},function(e,t,r){var n=r(7),o=r(8),c=r(9);e.exports=function(e,t){return n(e)||o(e,t)||c()}},function(e){e.exports=JSON.parse('{"a":"2.0.0"}')},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){var r=[],n=!0,o=!1,c=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,c=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw c}}return r}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(e,t,r){"use strict";r.r(t);var n=r(3);var b=function(e){return!(e&&(e.length||Object.keys(e).length))};var o=function(e){return Object.prototype.toString.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase()};var O=function(e){return"array"===o(e)};var a=function(e){return"number"===o(e)};var c=function(e){return"string"===o(e)};var u=function(e){return"object"===o(e)};var f=function(e){return"boolean"===o(e)},i=r(0),v=r.n(i),s=r(1),h=r.n(s);var p=function(e){return"undefined"===o(e)};function l(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}var y="[Circular]";var d=function(t){if(p(t))throw new Error("[chober]: nothing to clone.");function r(e){var t=Object.keys(e).reduce(function(t,r){try{return JSON.stringify(e[r]),t}catch(e){return[].concat(h()(t),[r])}},[]).reduce(function(e,t){return function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(r,!0).forEach(function(e){v()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},e,v()({},t,y))},e);return JSON.parse(JSON.stringify(t))}var n,o;try{return JSON.parse(JSON.stringify(t))}catch(e){if(u(t)){var c=r(t);if(!b(c))return c}if(O(t)){var i=(o=(n=t).reduce(function(t,e,r){try{return JSON.stringify(e),t}catch(e){return[].concat(h()(t),[r])}},[]).reduce(function(e,t){return e[t]=y,e},n),JSON.parse(JSON.stringify(o)));if(!b(i))return i}throw new Error(e)}};function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function w(e,t){function r(e){var r=d(e);return u(r)?Object.keys(r).sort().reduce(function(e,t){return function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(r,!0).forEach(function(e){v()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},e,v()({},t,r[t]))},{}):r}return JSON.stringify(r(e))===JSON.stringify(r(t))}var m=function(e){return null==e};function j(e){return"function"===o(e)}var P=r(2),S=r.n(P);function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function x(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?E(r,!0).forEach(function(e){v()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):E(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var D=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.arrays,r=void 0===t?[]:t,n=e.isParse,o=void 0===n||n,c=window.location.search.substr(1),i={};if(""===c)return{};if(0!==r.length&&(i=r.reduce(function(e,t){return x({},e,v()({},t,[]))},{})),c.split("&").forEach(function(e){if(e){var t=e.split("="),r=S()(t,2),n=r[0],o=r[1];Object.prototype.hasOwnProperty.call(i,n)&&(O(i[n])?i[n].push(o):i[n]=[i[n],o]),O(i[n])?i[n].forEach(function(e,t){i[n][t]=decodeURIComponent(e)}):i[n]=decodeURIComponent(o)}}),o){var u=function(t){try{var e=JSON.parse(t);return a(e)||f(e)||m(e)?e:t}catch(e){return t}};i=Object.entries(i).reduce(function(e,t){var r=S()(t,2),n=r[0],o=r[1];return x({},e,v()({},n,O(o)?o.map(function(e){return u(e)}):u(o)))},{})}return i};function k(){var e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",e.style.msOverflowStyle="scrollbar",document.body.appendChild(e);var t=e.offsetWidth;e.style.overflow="scroll";var r=document.createElement("div");r.style.width="100%",e.appendChild(r);var n=r.offsetWidth;return e.parentNode.removeChild(e),t-n}function C(e){if(p(e))throw new Error("[chober]: key is not passed.");if(!c(e))throw new Error("[chober]: key must to be a string.");var t="; ".concat(document.cookie).split("; ".concat(e,"="));return 2===t.length?t.pop().split(";").shift():""}function N(e){if(p(e))throw new Error("[chober]: item is not passed.");var t=(c(e)?document.querySelector(e):e).getBoundingClientRect(),r=window.pageXOffset,n=window.pageYOffset;return{x:t.left+r,y:t.top+n,left:t.left+r,top:t.top+n,right:t.right+r,bottom:t.bottom+n}}function J(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function I(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?J(r,!0).forEach(function(e){v()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):J(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function R(e,n){var t=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(p(n))throw new Error("[chober]: param is not passed.");var r=e.reduce(function(e,r){var t=r[n];return I({},e,{},O(t)?t.reduce(function(e,t){return I({},e,v()({},t,[].concat(h()(e[t]||[]),[r])))},e):v()({},t,[].concat(h()(e[t]||[]),[r])))},{});return t?Object.values(r):r}var U=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];if(!O(e))throw new Error("[chober]: param must to be an array.");return d(e).map(function(e){return JSON.stringify(e)}).filter(function(e,t,r){return r.indexOf(e)===t}).map(function(e){return JSON.parse(e)})};var T=function r(e){return O(e)?e.reduce(function(e,t){return O(t)?e.concat(r(t)):e.concat(t)},[]):[]};function _(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?_(r,!0).forEach(function(e){v()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function M(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t.isSaveOld,n=void 0===r||r,o=t.isSaveHash,c=void 0===o||o,i=t.isSaveEmptyFields,u=void 0!==i&&i,f=Object.prototype.hasOwnProperty,a=e?Object.entries(e).reduce(function(e,t){var r=t[0],n=O(t[1])?U(T(t[1]).map(function(e){return String(e)})):t[1];return A({},e,v()({},r,n))},{}):{},s=n&&D(),p=n&&Object.entries(a).concat(Object.entries(s)),l=c&&window.location.href.split("#")[1],y=n&&!b(s)?p.reduce(function(e,t){var r=t[0],n=t[1],o=f.call(e,r),c=f.call(s,r);if(!o||c)return o&&c?e:A({},e,v()({},r,n));var i=e[r]===n?n:[e[r],n],u=O(e[r])?U([].concat(h()(e[r]),h()(n))):i,a=O(n)?U([].concat(h()(n),h()(e[r]))):u;return A({},e,v()({},r,a))},{}):a,d=Object.keys(y).map(function(t){if("&"===t)return"";var e,r=y[t];return e=u?t?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(r)):"":t&&r?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(r)):"",O(r)?r.map(function(e){return u?t?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e)):"":t&&e?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e)):""}).filter(function(e){return e}).join("&"):e}).filter(function(e){return e}).join("&");window.history.pushState({},document.title,d?"?".concat(d).concat(l?"#".concat(l):""):window.location.href.split("?")[0].split("#")[0]+(l?"#".concat(l):""))}function q(e,t){var r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(p(e)||p(t))throw new Error("[chober]: key or value is not passed.");var n=r&&(new Date).getTime()+r,o=r&&new Date(n).toUTCString(),c="".concat(e,"=").concat(t,"; path=/"),i="; expires=".concat(o);document.cookie=r?c:c+i}function $(e){if(p(e))throw new Error("[chober]: key is not passed.");document.cookie="".concat(e,"=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;")}function B(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:" ";return String(e||0).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g,"$1".concat(t))}function Q(e){var o=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(!u(e))throw new Error("[chober]: param is not an object.");return Object.entries(e).map(function(e){var t=S()(e,2),r=t[0],n=t[1];return O(n)?n.map(function(e){return"".concat(r).concat(o?"[]":"","=").concat(e)}).join("&"):"".concat(r,"=").concat(n)}).join("&")}function W(e){if(p(e))throw new Error("[chober]: item is not passed.");(c(e)?document.querySelector(e):e).scrollIntoView({block:"center",behavior:"smooth",inline:"end"})}var F=n.a;
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("_c",[],e):"object"==typeof exports?exports._c=e():t._c=e()}("undefined"==typeof self?this:self,function(){return(n={},o.m=r=[function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}},function(t,e,r){var n=r(4),o=r(5),c=r(6);t.exports=function(t){return n(t)||o(t)||c()}},function(t,e,r){var n=r(7),o=r(8),c=r(9);t.exports=function(t,e){return n(t)||o(t,e)||c()}},function(t){t.exports=JSON.parse('{"a":"2.0.1"}')},function(t,e){t.exports=function(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}},function(t,e){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,e){t.exports=function(t){if(Array.isArray(t))return t}},function(t,e){t.exports=function(t,e){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var r=[],n=!0,o=!1,c=void 0;try{for(var i,u=t[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!e||r.length!==e);n=!0);}catch(t){o=!0,c=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw c}}return r}}},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e,r){"use strict";r.r(e);var n=r(3);var d=function(t){return!(t&&(t.length||Object.keys(t).length))};var o=function(t){return Object.prototype.toString.call(t).replace(/^\[object (.+)\]$/,"$1").toLowerCase()};var O=function(t){return"array"===o(t)};var a=function(t){return"number"===o(t)};var c=function(t){return"string"===o(t)};var u=function(t){return"object"===o(t)};var f=function(t){return"boolean"===o(t)},i=r(0),v=r.n(i),s=r(1),h=r.n(s);var p=function(t){return"undefined"===o(t)};function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var y="[Circular]";var b=function(e){if(p(e))throw new Error("[chober]: nothing to clone.");function r(t){var e=Object.keys(t).reduce(function(e,r){try{return JSON.stringify(t[r]),e}catch(t){return[].concat(h()(e),[r])}},[]).reduce(function(t,e){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(r,!0).forEach(function(t){v()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},t,v()({},e,y))},t);return JSON.parse(JSON.stringify(e))}var n,o;try{return JSON.parse(JSON.stringify(e))}catch(t){if(u(e)){var c=r(e);if(!d(c))return c}if(O(e)){var i=(o=(n=e).reduce(function(e,t,r){try{return JSON.stringify(t),e}catch(t){return[].concat(h()(e),[r])}},[]).reduce(function(t,e){return t[e]=y,t},n),JSON.parse(JSON.stringify(o)));if(!d(i))return i}throw new Error(t)}};function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function j(t,e){function r(t){var r=b(t);return u(r)?Object.keys(r).sort().reduce(function(t,e){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(r,!0).forEach(function(t){v()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},t,v()({},e,r[e]))},{}):r}return JSON.stringify(r(t))===JSON.stringify(r(e))}var m=function(t){return null==t};function w(t){return"function"===o(t)}var P=r(2),S=r.n(P);function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(r,!0).forEach(function(t){v()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var D=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},e=t.arrays,r=void 0===e?[]:e,n=t.isParse,o=void 0===n||n,c=window.location.search.substr(1),i={};if(""===c)return{};if(0!==r.length&&(i=r.reduce(function(t,e){return x({},t,v()({},e,[]))},{})),c.split("&").forEach(function(t){if(t){var e=t.split("="),r=S()(e,2),n=r[0],o=r[1];Object.prototype.hasOwnProperty.call(i,n)&&(O(i[n])?i[n].push(o):i[n]=[i[n],o]),O(i[n])?i[n].forEach(function(t,e){i[n][e]=decodeURIComponent(t)}):i[n]=decodeURIComponent(o)}}),o){var u=function(e){try{var t=JSON.parse(e);return a(t)||f(t)||m(t)?t:e}catch(t){return e}};i=Object.entries(i).reduce(function(t,e){var r=S()(e,2),n=r[0],o=r[1];return x({},t,v()({},n,O(o)?o.map(function(t){return u(t)}):u(o)))},{})}return i};function k(){var t=document.createElement("div");t.style.visibility="hidden",t.style.width="100px",t.style.msOverflowStyle="scrollbar",document.body.appendChild(t);var e=t.offsetWidth;t.style.overflow="scroll";var r=document.createElement("div");r.style.width="100%",t.appendChild(r);var n=r.offsetWidth;return t.parentNode.removeChild(t),e-n}function C(t){if(p(t))throw new Error("[chober]: key is not passed.");if(!c(t))throw new Error("[chober]: key must to be a string.");var e="; ".concat(document.cookie).split("; ".concat(t,"="));return 2===e.length?e.pop().split(";").shift():""}function N(t){if(p(t))throw new Error("[chober]: item is not passed.");var e=(c(t)?document.querySelector(t):t).getBoundingClientRect(),r=window.pageXOffset,n=window.pageYOffset;return{x:e.left+r,y:e.top+n,left:e.left+r,top:e.top+n,right:e.right+r,bottom:e.bottom+n}}function J(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function I(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?J(r,!0).forEach(function(t){v()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):J(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function R(t,n){var e=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(p(n))throw new Error("[chober]: param is not passed.");var r=t.reduce(function(t,r){var e=r[n];return I({},t,{},O(e)?e.reduce(function(t,e){return I({},t,v()({},e,[].concat(h()(t[e]||[]),[r])))},t):v()({},e,[].concat(h()(t[e]||[]),[r])))},{});return e?Object.values(r):r}var U=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];if(!O(t))throw new Error("[chober]: param must to be an array.");return b(t).map(function(t){return JSON.stringify(t)}).filter(function(t,e,r){return r.indexOf(t)===e}).map(function(t){return JSON.parse(t)})};var T=function r(t){return O(t)?t.reduce(function(t,e){return O(e)?t.concat(r(e)):t.concat(e)},[]):[]};function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(r,!0).forEach(function(t){v()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function M(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=e.isSaveOld,n=void 0===r||r,o=e.isSaveHash,c=void 0===o||o,i=e.isSaveEmptyFields,u=void 0!==i&&i,f=Object.prototype.hasOwnProperty,a=t?Object.entries(t).reduce(function(t,e){var r=e[0],n=O(e[1])?U(T(e[1]).map(function(t){return String(t)})):e[1];return _({},t,v()({},r,n))},{}):{},s=n&&D(),p=n&&Object.entries(a).concat(Object.entries(s)),l=c&&window.location.href.split("#")[1],y=n&&!d(s)?p.reduce(function(t,e){var r=e[0],n=e[1],o=f.call(t,r),c=f.call(s,r);if(!o||c)return o&&c?t:_({},t,v()({},r,n));var i=t[r]===n?n:[t[r],n],u=O(t[r])?U([].concat(h()(t[r]),h()(n))):i,a=O(n)?U([].concat(h()(n),h()(t[r]))):u;return _({},t,v()({},r,a))},{}):a,b=Object.keys(y).map(function(e){if("&"===e)return"";var t,r=y[e];return t=u?e?"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(r)):"":e&&r?"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(r)):"",O(r)?r.map(function(t){return u?e?"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t)):"":e&&t?"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t)):""}).filter(function(t){return t}).join("&"):t}).filter(function(t){return t}).join("&");window.history.pushState({},document.title,b?"?".concat(b).concat(l?"#".concat(l):""):window.location.href.split("?")[0].split("#")[0]+(l?"#".concat(l):""))}function q(t,e){var r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(p(t)||p(e))throw new Error("[chober]: key or value is not passed.");var n=r&&(new Date).getTime()+r,o=r&&new Date(n).toUTCString(),c="".concat(t,"=").concat(e,"; path=/"),i="; expires=".concat(o);document.cookie=r?c:c+i}function $(t){if(p(t))throw new Error("[chober]: key is not passed.");document.cookie="".concat(t,"=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;")}function B(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:" ";return String(t||0).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g,"$1".concat(e))}function Q(t){var o=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(!u(t))throw new Error("[chober]: param is not an object.");return Object.entries(t).map(function(t){var e=S()(t,2),r=e[0],n=e[1];return O(n)?n.map(function(t){return"".concat(r).concat(o?"[]":"","=").concat(t)}).join("&"):"".concat(r,"=").concat(n)}).join("&")}function W(t){var e=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(p(t))throw new Error("[chober]: item is not passed.");(c(t)?document.querySelector(t):t).scrollIntoView({block:"center",inline:e?"center":"nearest",behavior:"smooth",left:0})}var F=n.a;
/**

@@ -9,2 +9,2 @@ * Chober.js - is a collection of useful methods that are used by programmers every day.

* @license https://github.com/BrooonS/chober/blob/master/LICENSE
*/t.default={VERSION:F,isEmpty:b,isArray:O,isNumber:a,isString:c,isObject:u,isBoolean:f,isEqual:w,isUndefined:p,isNil:m,isFunction:j,getQuery:D,getScrollbarWidth:k,getCookie:C,getOffset:N,getType:o,groupBy:R,setQuery:M,setCookie:q,removeCookie:$,clone:d,flattenDeep:T,formatNumber:B,formatQuery:Q,scrollTo:W,uniq:U}}],o.c=n,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=10)).default;function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var r,n});
*/e.default={VERSION:F,isEmpty:d,isArray:O,isNumber:a,isString:c,isObject:u,isBoolean:f,isEqual:j,isUndefined:p,isNil:m,isFunction:w,getQuery:D,getScrollbarWidth:k,getCookie:C,getOffset:N,getType:o,groupBy:R,setQuery:M,setCookie:q,removeCookie:$,clone:b,flattenDeep:T,formatNumber:B,formatQuery:Q,scrollTo:W,uniq:U}}],o.c=n,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=10)).default;function o(t){if(n[t])return n[t].exports;var e=n[t]={i:t,l:!1,exports:{}};return r[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}var r,n});
![logo](_media/logo.png)
# Chober <small>1.3.2</small>
# Chober <small>2.0.0</small>

@@ -5,0 +5,0 @@ > Is a collection of useful methods.

@@ -37,3 +37,3 @@ # Chober.js

<!-- With version -->
<script src="https://cdn.jsdelivr.net/npm/chober@1.3.2/dist/chober.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chober@2.0.0/dist/chober.min.js"></script>
```

@@ -197,9 +197,3 @@

```JS
const query = { value: 'test', field: ['hi', 'hello'] };
formatQuery(query)
// => value=test&field=hi&field=hello
const query = { value: ['test'], field: 'hi' }
formatQuery(query, true)
// => value[]=test&field=hi
const query = { value: 'test', field: ['hi', 'hello'] }; formatQuery(query) // => value=test&field=hi&field=hello const query = { value: ['test'], field: 'hi' } formatQuery(query, true) // => value[]=test&field=hi
```

@@ -328,32 +322,3 @@ <a href="https://github.com/BrooonS/chober/blob/master/lib/formatQuery.js" target="_blank">Source code</a>

```JS
const array = [
{ id: 1, prop1: 'a', prop2: ['d', 'y'] },
{ id: 2, prop1: 'a', prop2: 'c' },
{ id: 3, prop1: 'b', prop2: 'd' },
];
groupBy(array, 'prop2');
// => {
// d: [
// { id: 1, prop1: 'a', prop2: ['d', 'y'] },
// { id: 3, prop1: 'b', prop2: 'd' }
// ],
// y: [
// { id: 1, prop1: 'a', prop2: ['d', 'y'] }
// ],
// c: [
// { id: 2, prop1: 'a', prop2: 'c' }
// ]
// }
groupBy(array, 'prop1', true);
// => [
// [
// { id: 1, prop1: 'a', prop2: ['d', 'y'] },
// { id: 2, prop1: 'a', prop2: 'c' },
// ],
// [
// { id: 3, prop1: 'b', prop2: 'd' },
// ],
// ]
const array = [ { id: 1, prop1: 'a', prop2: ['d', 'y'] }, { id: 2, prop1: 'a', prop2: 'c' }, { id: 3, prop1: 'b', prop2: 'd' }, ]; groupBy(array, 'prop2'); // => { // d: [ // { id: 1, prop1: 'a', prop2: ['d', 'y'] }, // { id: 3, prop1: 'b', prop2: 'd' } // ], // y: [ // { id: 1, prop1: 'a', prop2: ['d', 'y'] } // ], // c: [ // { id: 2, prop1: 'a', prop2: 'c' } // ] // } groupBy(array, 'prop1', true); // => [ // [ // { id: 1, prop1: 'a', prop2: ['d', 'y'] }, // { id: 2, prop1: 'a', prop2: 'c' }, // ], // [ // { id: 3, prop1: 'b', prop2: 'd' }, // ], // ]
```

@@ -605,2 +570,5 @@ <a href="https://github.com/BrooonS/chober/blob/master/lib/groupBy.js" target="_blank">Source code</a>

- Description: *Selector or HTML element to which to scroll.*
- `isHorizontalEnabled`
- Type: `Boolean`
- Description: *Enable horizontal scroll. Default: false.*

@@ -607,0 +575,0 @@

@@ -27,3 +27,3 @@ import isObject from './isObject';

.map(([key, value]) => (isArray(value)
? value.map(item => `${key}${isArrayShown ? '[]' : ''}=${item}`).join('&')
? value.map((item) => `${key}${isArrayShown ? '[]' : ''}=${item}`).join('&')
: `${key}=${value}`))

@@ -30,0 +30,0 @@ .join('&');

@@ -84,3 +84,3 @@ import isArray from './isArray';

[key]: isArray(value)
? value.map(item => tryToParse(item))
? value.map((item) => tryToParse(item))
: tryToParse(value),

@@ -87,0 +87,0 @@ }), {});

@@ -0,0 +0,0 @@ import isUndefined from './isUndefined';

@@ -9,2 +9,3 @@ import isUndefined from './isUndefined';

* @param {String|HTMLElement} item Selector or HTML element to which to scroll.
* @param {Boolean} isHorizontalEnabled Enable horizontal scroll. Default: false.
*

@@ -16,3 +17,3 @@ * @example

*/
function scrollTo(item) {
function scrollTo(item, isHorizontalEnabled = false) {
if (isUndefined(item)) {

@@ -23,5 +24,10 @@ throw new Error('[chober]: item is not passed.');

(isString(item) ? document.querySelector(item) : item)
.scrollIntoView({ block: 'center', behavior: 'smooth', inline: 'end' });
.scrollIntoView({
block: 'center',
inline: isHorizontalEnabled ? 'center' : 'nearest',
behavior: 'smooth',
left: 0,
});
}
export default scrollTo;

@@ -43,3 +43,3 @@ import getQuery from './getQuery';

const fieldValue = isArray(field[1])
? uniq(flattenDeep(field[1]).map(value => String(value)))
? uniq(flattenDeep(field[1]).map((value) => String(value)))
: field[1];

@@ -112,7 +112,7 @@

})
.filter(queryItem => queryItem)
.filter((queryItem) => queryItem)
.join('&')
: fieldValue;
})
.filter(queryItem => queryItem)
.filter((queryItem) => queryItem)
.join('&');

@@ -119,0 +119,0 @@

@@ -26,9 +26,9 @@ import isArray from './isArray';

const arrayOfStrings = clone(array).map(item => JSON.stringify(item));
const arrayOfStrings = clone(array).map((item) => JSON.stringify(item));
const filteredArray = arrayOfStrings
.filter((item, index, currentArray) => currentArray.indexOf(item) === index);
return filteredArray.map(item => JSON.parse(item));
return filteredArray.map((item) => JSON.parse(item));
}
export default uniq;
{
"name": "chober",
"version": "2.0.0",
"version": "2.0.1",
"description": "Chober.js - is a collection of methods that are used by programmers every day. We decided to put all the methods together so as not to copy them from project to project.",

@@ -61,22 +61,22 @@ "main": "dist/chober.js",

"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/core": "^7.7.2",
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
"@babel/plugin-transform-object-assign": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/runtime": "^7.5.5",
"babel-eslint": "^10.0.2",
"@babel/plugin-transform-runtime": "^7.6.2",
"@babel/preset-env": "^7.7.1",
"@babel/runtime": "^7.7.2",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"docsify-cli": "^4.3.0",
"eslint": "^6.1.0",
"eslint-config-airbnb": "^17.1.1",
"eslint-loader": "^2.2.1",
"eslint": "^6.6.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-loader": "^3.0.2",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"jsdoc-to-markdown": "^5.0.0",
"eslint-plugin-react": "^7.16.0",
"jsdoc-to-markdown": "^5.0.2",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^4.38.0",
"webpack-cli": "^3.3.6"
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc