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

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 1.0.3 to 1.0.4

16

dist/chober.js

@@ -1066,9 +1066,5 @@ (function webpackUniversalModuleDefinition(root, factory) {

var isSaveOldQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (!query) {
throw new Error('[chober]: query is not passed.');
}
var oldQuery = Object(_getQuery__WEBPACK_IMPORTED_MODULE_2__["default"])();
var mergedQueries = Object.entries(query).concat(Object.entries(oldQuery));
var localQuery = query || {};
var oldQuery = isSaveOldQuery && Object(_getQuery__WEBPACK_IMPORTED_MODULE_2__["default"])();
var mergedQueries = Object.entries(localQuery).concat(Object.entries(oldQuery));
var newQueryObject = isSaveOldQuery && !Object(_isEmpty__WEBPACK_IMPORTED_MODULE_3__["default"])(oldQuery) ? mergedQueries.reduce(function (newQuery, field) {

@@ -1087,3 +1083,3 @@ var fieldName = field[0];

return _babel_runtime_helpers_objectSpread__WEBPACK_IMPORTED_MODULE_1___default()({}, newQuery, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, fieldName, fieldValue));
}, {}) : query;
}, {}) : localQuery;
var newQueryString = Object.keys(newQueryObject).map(function (key) {

@@ -1099,3 +1095,3 @@ if (key === '&') return '';

.join('&');
window.history.pushState({}, document.title, newQueryString ? "?".concat(decodeURIComponent(newQueryString)) : '?');
window.history.pushState({}, document.title, newQueryString ? "?".concat(decodeURIComponent(newQueryString)) : window.location.href.split('?')[0]);
}

@@ -1252,3 +1248,3 @@

module.exports = {"name":"chober","version":"1.0.3","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.","main":"dist/chober.js","scripts":{"prod":"webpack --env production --config webpack.config.js","dev":"webpack --env development --config webpack.config.js","watch":"webpack --env development --config webpack.config.js --watch","build":"npm run docs && npm run prod && npm run dev","docs":"jsdoc2md --template README.hbs --files lib/*.js > docs/README.md","docs-server":"docsify serve docs -p 35730"},"repository":{"type":"git","url":"git+https://github.com/BrooonS/chober.js.git"},"keywords":["webpack","js","javascript","library","es6","commonjs","methods","chober","isEmpty","isArray","isNumber","isString","isObject","isBoolean","getQuery","getNumbers","getScrollbarWidth","getCookie","getOffset","getType","setQuery","setCookie","removeCookie","clone","invertObject","first","formatNumber","debounce","scrollTo","uniq"],"author":"Valery Strelets","license":"MIT","bugs":{"url":"https://github.com/BrooonS/chober.js/issues"},"homepage":"https://github.com/BrooonS/chober.js#readme","devDependencies":{"@babel/core":"^7.1.2","@babel/plugin-proposal-object-rest-spread":"^7.0.0","@babel/plugin-transform-object-assign":"^7.0.0","@babel/plugin-transform-runtime":"^7.1.0","@babel/preset-env":"^7.1.0","@babel/runtime":"^7.1.2","babel-eslint":"^10.0.1","babel-loader":"^8.0.4","docsify-cli":"^4.2.1","eslint":"^5.6.1","eslint-config-airbnb":"^17.1.0","eslint-loader":"^2.1.1","eslint-plugin-import":"^2.14.0","eslint-plugin-jsx-a11y":"^6.1.2","eslint-plugin-react":"^7.11.1","jsdoc-to-markdown":"^4.0.1","uglifyjs-webpack-plugin":"^2.0.1","webpack":"^4.20.2","webpack-cli":"^3.1.2"}};
module.exports = {"name":"chober","version":"1.0.4","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.","main":"dist/chober.js","scripts":{"prod":"webpack --env production --config webpack.config.js","dev":"webpack --env development --config webpack.config.js","watch":"webpack --env development --config webpack.config.js --watch","build":"npm run docs && npm run prod && npm run dev","docs":"jsdoc2md --template README.hbs --files lib/*.js > docs/README.md","docs-server":"docsify serve docs -p 35730"},"repository":{"type":"git","url":"git+https://github.com/BrooonS/chober.js.git"},"keywords":["webpack","js","javascript","library","es6","commonjs","methods","chober","isEmpty","isArray","isNumber","isString","isObject","isBoolean","getQuery","getNumbers","getScrollbarWidth","getCookie","getOffset","getType","setQuery","setCookie","removeCookie","clone","invertObject","first","formatNumber","debounce","scrollTo","uniq"],"author":"Valery Strelets","license":"MIT","bugs":{"url":"https://github.com/BrooonS/chober.js/issues"},"homepage":"https://github.com/BrooonS/chober.js#readme","devDependencies":{"@babel/core":"^7.1.2","@babel/plugin-proposal-object-rest-spread":"^7.0.0","@babel/plugin-transform-object-assign":"^7.0.0","@babel/plugin-transform-runtime":"^7.1.0","@babel/preset-env":"^7.1.0","@babel/runtime":"^7.1.2","babel-eslint":"^10.0.1","babel-loader":"^8.0.4","docsify-cli":"^4.2.1","eslint":"^5.6.1","eslint-config-airbnb":"^17.1.0","eslint-loader":"^2.1.1","eslint-plugin-import":"^2.14.0","eslint-plugin-jsx-a11y":"^6.1.2","eslint-plugin-react":"^7.11.1","jsdoc-to-markdown":"^4.0.1","uglifyjs-webpack-plugin":"^2.0.1","webpack":"^4.20.2","webpack-cli":"^3.1.2"}};

@@ -1255,0 +1251,0 @@ /***/ })

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

!function webpackUniversalModuleDefinition(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("_c",[],r):"object"==typeof exports?exports._c=r():e._c=r()}("undefined"!=typeof self?self:this,function(){return function(t){var n={};function __webpack_require__(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,__webpack_require__),r.l=!0,r.exports}return __webpack_require__.m=t,__webpack_require__.c=n,__webpack_require__.d=function(e,r,t){__webpack_require__.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(r,e){if(1&e&&(r=__webpack_require__(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(__webpack_require__.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)__webpack_require__.d(t,n,function(e){return r[e]}.bind(null,n));return t},__webpack_require__.n=function(e){var r=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(r,"a",r),r},__webpack_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=5)}([function(e,r){e.exports=function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}},function(e,r,t){var o=t(0);e.exports=function _objectSpread(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(e){o(r,e,t[e])})}return r}},function(e,r){function _extends(){return e.exports=_extends=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},_extends.apply(this,arguments)}e.exports=_extends},function(e,r){e.exports=function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}},function(e){e.exports={a:"1.0.3"}},function(e,r,t){"use strict";t.r(r);var n=t(2),o=t.n(n),i=t(3),c=t.n(i),u=t(4);var a=function isEmpty(e){return!(e&&(e.length||Object.keys(e).length))};var f=function getType(e){return Object.prototype.toString.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase()};var s=function isArray(e){return"array"===f(e)};var p=function isNumber(e){return"number"===f(e)};var l=function isString(e){return"string"===f(e)};var d=function isObject(e){return"object"===f(e)};var b=function isBoolean(e){return"boolean"===f(e)},_=t(0),h=t.n(_),w=t(1),y=t.n(w);var v=function getQuery(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],r=window.location.search.substr(1),n={};return r?(e.length&&o()(n,e.reduce(function(e,r){return y()({},e,h()({},r,[]))},{})),r.split("&").forEach(function(e){if(e){var t=e.split("=");Object.prototype.hasOwnProperty.call(n,t[0])&&(s(n[t[0]])?n[t[0]].push(t[1]):n[t[0]]=[n[t[0]],t[1]]),s(n[t[0]])?n[t[0]].forEach(function(e,r){n[t[0]][r]=decodeURIComponent(e)}):n[t[0]]=decodeURIComponent(t[1])}}),n):{}};var g=function getNumbers(e){if(!e)throw new Error("[chober]: string or number is not passed.");return String(e).replace(/\D+/g,"")};var m=function getScrollbarWidth(){return window.innerWidth-document.documentElement.clientWidth};var O=function getCookie(e){if(!e)throw new Error("[chober]: key is not passed.");var r="; ".concat(document.cookie).split("; ".concat(e,"="));return 2===r.length?r.pop().split(";").shift():""};var j=function getOffset(e){if(!e)throw new Error("[chober]: selector is not passed.");var r=document.querySelector(e).getBoundingClientRect(),t=window.pageXOffset,n=window.pageYOffset;return{x:r.left+t,y:r.top+n,left:r.left+t,top:r.top+n,right:r.right+t,bottom:r.bottom+n}};var k=function uniq(e){if(!e)throw new Error("[chober]: array is not passed.");return e.filter(function(e,r,t){return t.indexOf(e)===r})};var C=function setQuery(e){var r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];if(!e)throw new Error("[chober]: query is not passed.");var t=v(),n=Object.entries(e).concat(Object.entries(t)),o=r&&!a(t)?n.reduce(function(e,r){var t=r[0],n=r[1];if(Object.prototype.hasOwnProperty.call(e,t)){var o=e[t]===n?n:[e[t],n],i="array"===f(e[t])?k(e[t].concat(n)):o,c="array"===f(n)?k(n.concat(e[t])):i;return y()({},e,h()({},t,c))}return y()({},e,h()({},t,n))},{}):e,i=Object.keys(o).map(function(r){if("&"===r)return"";var e=r&&o[r]?"".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(o[r])):"";return Array.isArray(o[r])?o[r].map(function(e){return e&&r?"".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(e)):""}).join("&"):e}).filter(function(e){return e}).join("&");window.history.pushState({},document.title,i?"?".concat(decodeURIComponent(i)):"?")};var x=function setCookie(e,r){var t=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(!e&&!r)throw new Error("[chober]: key or value is not passed.");var n=t&&(new Date).getTime()+t,o=t&&new Date(n).toUTCString(),i="".concat(e,"=").concat(r,"; path=/"),c="; expires=".concat(o);document.cookie=t?i:i+c};var E=function removeCookie(e){if(!e)throw new Error("[chober]: key is not passed.");document.cookie="".concat(e,"=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;")};var S=function clone(e){if(!e)throw new Error("[chober]: nothing to clone.");return e&&JSON.parse(JSON.stringify(e))};var q=function invertObject(e){if(!e)throw new Error("[chober]: object is not passed.");return e&&Object.entries(e).reduce(function(e,r){return y()({},e,h()({},r[1],r[0]))},{})};var T=function first(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;if(!e)throw new Error("[chober]: array is not passed.");return s(e)?e.slice(0,r):[]};var N=function formatNumber(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:" ";if(!e)throw new Error("[chober]: number is not passed.");return String(e).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g,"$1".concat(r))};var P=function debounce(n,o){var i=this;if(!n&&!o)throw new Error("[chober]: function or delay is not passed.");var c=null;return function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];c&&clearTimeout(c),c=setTimeout(function onComplete(){n.apply(i,r),c=null},o)}};var I=function scrollTo(e){if(!e)throw new Error("[chober]: element is not passed.");e.scrollIntoView({behavior:"smooth"})};t.d(r,"VERSION",function(){return R}),t.d(r,"isEmpty",function(){return a}),t.d(r,"isArray",function(){return s}),t.d(r,"isNumber",function(){return p}),t.d(r,"isString",function(){return l}),t.d(r,"isObject",function(){return d}),t.d(r,"isBoolean",function(){return b}),t.d(r,"getQuery",function(){return v}),t.d(r,"getNumbers",function(){return g}),t.d(r,"getScrollbarWidth",function(){return m}),t.d(r,"getCookie",function(){return O}),t.d(r,"getOffset",function(){return j}),t.d(r,"getType",function(){return f}),t.d(r,"setQuery",function(){return C}),t.d(r,"setCookie",function(){return x}),t.d(r,"removeCookie",function(){return E}),t.d(r,"clone",function(){return S}),t.d(r,"invertObject",function(){return q}),t.d(r,"first",function(){return T}),t.d(r,"formatNumber",function(){return N}),t.d(r,"debounce",function(){return P}),t.d(r,"scrollTo",function(){return I}),t.d(r,"uniq",function(){return k});
!function webpackUniversalModuleDefinition(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("_c",[],r):"object"==typeof exports?exports._c=r():e._c=r()}("undefined"!=typeof self?self:this,function(){return function(t){var n={};function __webpack_require__(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,__webpack_require__),r.l=!0,r.exports}return __webpack_require__.m=t,__webpack_require__.c=n,__webpack_require__.d=function(e,r,t){__webpack_require__.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(r,e){if(1&e&&(r=__webpack_require__(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(__webpack_require__.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)__webpack_require__.d(t,n,function(e){return r[e]}.bind(null,n));return t},__webpack_require__.n=function(e){var r=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(r,"a",r),r},__webpack_require__.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=5)}([function(e,r){e.exports=function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}},function(e,r,t){var o=t(0);e.exports=function _objectSpread(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},n=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.forEach(function(e){o(r,e,t[e])})}return r}},function(e,r){function _extends(){return e.exports=_extends=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},_extends.apply(this,arguments)}e.exports=_extends},function(e,r){e.exports=function _classCallCheck(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}},function(e){e.exports={a:"1.0.4"}},function(e,r,t){"use strict";t.r(r);var n=t(2),o=t.n(n),i=t(3),c=t.n(i),u=t(4);var a=function isEmpty(e){return!(e&&(e.length||Object.keys(e).length))};var f=function getType(e){return Object.prototype.toString.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase()};var s=function isArray(e){return"array"===f(e)};var l=function isNumber(e){return"number"===f(e)};var p=function isString(e){return"string"===f(e)};var d=function isObject(e){return"object"===f(e)};var b=function isBoolean(e){return"boolean"===f(e)},_=t(0),h=t.n(_),w=t(1),y=t.n(w);var v=function getQuery(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],r=window.location.search.substr(1),n={};return r?(e.length&&o()(n,e.reduce(function(e,r){return y()({},e,h()({},r,[]))},{})),r.split("&").forEach(function(e){if(e){var t=e.split("=");Object.prototype.hasOwnProperty.call(n,t[0])&&(s(n[t[0]])?n[t[0]].push(t[1]):n[t[0]]=[n[t[0]],t[1]]),s(n[t[0]])?n[t[0]].forEach(function(e,r){n[t[0]][r]=decodeURIComponent(e)}):n[t[0]]=decodeURIComponent(t[1])}}),n):{}};var g=function getNumbers(e){if(!e)throw new Error("[chober]: string or number is not passed.");return String(e).replace(/\D+/g,"")};var m=function getScrollbarWidth(){return window.innerWidth-document.documentElement.clientWidth};var O=function getCookie(e){if(!e)throw new Error("[chober]: key is not passed.");var r="; ".concat(document.cookie).split("; ".concat(e,"="));return 2===r.length?r.pop().split(";").shift():""};var j=function getOffset(e){if(!e)throw new Error("[chober]: selector is not passed.");var r=document.querySelector(e).getBoundingClientRect(),t=window.pageXOffset,n=window.pageYOffset;return{x:r.left+t,y:r.top+n,left:r.left+t,top:r.top+n,right:r.right+t,bottom:r.bottom+n}};var k=function uniq(e){if(!e)throw new Error("[chober]: array is not passed.");return e.filter(function(e,r,t){return t.indexOf(e)===r})};var C=function setQuery(e){var r=1<arguments.length&&void 0!==arguments[1]&&arguments[1],t=e||{},n=r&&v(),o=Object.entries(t).concat(Object.entries(n)),i=r&&!a(n)?o.reduce(function(e,r){var t=r[0],n=r[1];if(Object.prototype.hasOwnProperty.call(e,t)){var o=e[t]===n?n:[e[t],n],i="array"===f(e[t])?k(e[t].concat(n)):o,c="array"===f(n)?k(n.concat(e[t])):i;return y()({},e,h()({},t,c))}return y()({},e,h()({},t,n))},{}):t,c=Object.keys(i).map(function(r){if("&"===r)return"";var e=r&&i[r]?"".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(i[r])):"";return Array.isArray(i[r])?i[r].map(function(e){return e&&r?"".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(e)):""}).join("&"):e}).filter(function(e){return e}).join("&");window.history.pushState({},document.title,c?"?".concat(decodeURIComponent(c)):window.location.href.split("?")[0])};var x=function setCookie(e,r){var t=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(!e&&!r)throw new Error("[chober]: key or value is not passed.");var n=t&&(new Date).getTime()+t,o=t&&new Date(n).toUTCString(),i="".concat(e,"=").concat(r,"; path=/"),c="; expires=".concat(o);document.cookie=t?i:i+c};var S=function removeCookie(e){if(!e)throw new Error("[chober]: key is not passed.");document.cookie="".concat(e,"=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;")};var E=function clone(e){if(!e)throw new Error("[chober]: nothing to clone.");return e&&JSON.parse(JSON.stringify(e))};var q=function invertObject(e){if(!e)throw new Error("[chober]: object is not passed.");return e&&Object.entries(e).reduce(function(e,r){return y()({},e,h()({},r[1],r[0]))},{})};var T=function first(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;if(!e)throw new Error("[chober]: array is not passed.");return s(e)?e.slice(0,r):[]};var N=function formatNumber(e){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:" ";if(!e)throw new Error("[chober]: number is not passed.");return String(e).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g,"$1".concat(r))};var P=function debounce(n,o){var i=this;if(!n&&!o)throw new Error("[chober]: function or delay is not passed.");var c=null;return function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];c&&clearTimeout(c),c=setTimeout(function onComplete(){n.apply(i,r),c=null},o)}};var I=function scrollTo(e){if(!e)throw new Error("[chober]: element is not passed.");e.scrollIntoView({behavior:"smooth"})};t.d(r,"VERSION",function(){return R}),t.d(r,"isEmpty",function(){return a}),t.d(r,"isArray",function(){return s}),t.d(r,"isNumber",function(){return l}),t.d(r,"isString",function(){return p}),t.d(r,"isObject",function(){return d}),t.d(r,"isBoolean",function(){return b}),t.d(r,"getQuery",function(){return v}),t.d(r,"getNumbers",function(){return g}),t.d(r,"getScrollbarWidth",function(){return m}),t.d(r,"getCookie",function(){return O}),t.d(r,"getOffset",function(){return j}),t.d(r,"getType",function(){return f}),t.d(r,"setQuery",function(){return C}),t.d(r,"setCookie",function(){return x}),t.d(r,"removeCookie",function(){return S}),t.d(r,"clone",function(){return E}),t.d(r,"invertObject",function(){return q}),t.d(r,"first",function(){return T}),t.d(r,"formatNumber",function(){return N}),t.d(r,"debounce",function(){return P}),t.d(r,"scrollTo",function(){return I}),t.d(r,"uniq",function(){return k});
/**

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

*/
var R=u.a;r.default=new function Chober(){c()(this,Chober),o()(this,{VERSION:R,isEmpty:a,isArray:s,isNumber:p,isString:l,isObject:d,isBoolean:b,getQuery:v,getNumbers:g,getScrollbarWidth:m,getCookie:O,getOffset:j,getType:f,setQuery:C,setCookie:x,removeCookie:E,clone:S,invertObject:q,first:T,formatNumber:N,debounce:P,scrollTo:I,uniq:k})}}])});
var R=u.a;r.default=new function Chober(){c()(this,Chober),o()(this,{VERSION:R,isEmpty:a,isArray:s,isNumber:l,isString:p,isObject:d,isBoolean:b,getQuery:v,getNumbers:g,getScrollbarWidth:m,getCookie:O,getOffset:j,getType:f,setQuery:C,setCookie:x,removeCookie:S,clone:E,invertObject:q,first:T,formatNumber:N,debounce:P,scrollTo:I,uniq:k})}}])});
![logo](_media/logo.png)
# Chober <small>1.0.3</small>
# Chober <small>1.0.4</small>

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

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

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

@@ -37,0 +37,0 @@

@@ -25,8 +25,5 @@ import getQuery from './getQuery';

function setQuery(query, isSaveOldQuery = false) {
if (!query) {
throw new Error('[chober]: query is not passed.');
}
const oldQuery = getQuery();
const mergedQueries = Object.entries(query).concat(Object.entries(oldQuery));
const localQuery = query || {};
const oldQuery = isSaveOldQuery && getQuery();
const mergedQueries = Object.entries(localQuery).concat(Object.entries(oldQuery));
const newQueryObject = isSaveOldQuery && !isEmpty(oldQuery)

@@ -60,3 +57,3 @@ ? mergedQueries.reduce((newQuery, field) => {

}, {})
: query;
: localQuery;
const newQueryString = Object.keys(newQueryObject)

@@ -79,5 +76,11 @@ .map((key) => {

window.history.pushState({}, document.title, newQueryString ? `?${decodeURIComponent(newQueryString)}` : '?');
window.history.pushState(
{},
document.title,
newQueryString
? `?${decodeURIComponent(newQueryString)}`
: window.location.href.split('?')[0],
);
}
export default setQuery;
{
"name": "chober",
"version": "1.0.3",
"version": "1.0.4",
"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.",

@@ -5,0 +5,0 @@ "main": "dist/chober.js",

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

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

@@ -34,0 +34,0 @@

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