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 1.3.2 to 1.3.3

26

dist/chober.js

@@ -603,3 +603,5 @@ (function webpackUniversalModuleDefinition(root, factory) {

/* harmony import */ var _isUndefined__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isUndefined */ "./lib/isUndefined.js");
/* harmony import */ var _isString__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isString */ "./lib/isString.js");
/**

@@ -609,3 +611,3 @@ * Get absolute coordinates of an element.

* @since 0.1.0
* @param {String} selector Selector of HTML element to get coordinates of.
* @param {String} item Selector of HTML element to get coordinates of.
* @returns {Object}

@@ -618,8 +620,8 @@ *

function getOffset(selector) {
if (Object(_isUndefined__WEBPACK_IMPORTED_MODULE_0__["default"])(selector)) {
throw new Error('[chober]: selector is not passed.');
function getOffset(item) {
if (Object(_isUndefined__WEBPACK_IMPORTED_MODULE_0__["default"])(item)) {
throw new Error('[chober]: item is not passed.');
}
var element = document.querySelector(selector);
var element = Object(_isString__WEBPACK_IMPORTED_MODULE_1__["default"])(item) ? document.querySelector(item) : item;
var rect = element.getBoundingClientRect();

@@ -1229,3 +1231,5 @@ var scrollLeft = window.pageXOffset;

/* harmony import */ var _isUndefined__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isUndefined */ "./lib/isUndefined.js");
/* harmony import */ var _isString__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isString */ "./lib/isString.js");
/**

@@ -1235,3 +1239,3 @@ * Scroll to element in DOM.

* @since 0.2.0
* @param {DOMElement} element Element to which to scroll.
* @param {DOMElement} item Element to which to scroll.
*

@@ -1242,8 +1246,8 @@ * @example

function scrollTo(element) {
if (Object(_isUndefined__WEBPACK_IMPORTED_MODULE_0__["default"])(element)) {
throw new Error('[chober]: element is not passed.');
function scrollTo(item) {
if (Object(_isUndefined__WEBPACK_IMPORTED_MODULE_0__["default"])(item)) {
throw new Error('[chober]: item is not passed.');
}
element.scrollIntoView({
(Object(_isString__WEBPACK_IMPORTED_MODULE_1__["default"])(item) ? document.querySelector(item) : item).scrollIntoView({
block: 'center',

@@ -1703,3 +1707,3 @@ behavior: 'smooth',

module.exports = {"name":"chober","version":"1.3.2","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.git"},"keywords":["webpack","js","javascript","library","es6","commonjs","methods","chober","isEmpty","isArray","isNumber","isString","isObject","isBoolean","isEqual","isUndefined","isNil","isFunction","getQuery","getNumbers","getScrollbarWidth","getCookie","getOffset","getType","setQuery","setCookie","removeCookie","decodeHtml","clone","invertObject","first","flatten","formatNumber","debounce","scrollTo","uniq"],"author":"Valery Strelets","license":"MIT","bugs":{"url":"https://github.com/BrooonS/chober/issues"},"homepage":"https://github.com/BrooonS/chober#readme","devDependencies":{"@babel/core":"^7.1.6","@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.6","@babel/runtime":"^7.1.5","babel-eslint":"^10.0.1","babel-loader":"^8.0.4","docsify-cli":"^4.3.0","eslint":"^5.9.0","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.26.0","webpack-cli":"^3.1.2"}};
module.exports = {"name":"chober","version":"1.3.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.git"},"keywords":["webpack","js","javascript","library","es6","commonjs","methods","chober","isEmpty","isArray","isNumber","isString","isObject","isBoolean","isEqual","isUndefined","isNil","isFunction","getQuery","getNumbers","getScrollbarWidth","getCookie","getOffset","getType","setQuery","setCookie","removeCookie","decodeHtml","clone","invertObject","first","flatten","formatNumber","debounce","scrollTo","uniq"],"author":"Valery Strelets","license":"MIT","bugs":{"url":"https://github.com/BrooonS/chober/issues"},"homepage":"https://github.com/BrooonS/chober#readme","devDependencies":{"@babel/core":"^7.1.6","@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.6","@babel/runtime":"^7.1.5","babel-eslint":"^10.0.1","babel-loader":"^8.0.4","docsify-cli":"^4.3.0","eslint":"^5.9.0","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.26.0","webpack-cli":"^3.1.2"}};

@@ -1706,0 +1710,0 @@ /***/ })

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

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("_c",[],n):"object"==typeof exports?exports._c=n():t._c=n()}("undefined"==typeof self?this:self,function(){return function(e){var r={};function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=r,o.d=function(t,n,e){o.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},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(n,t){if(1&t&&(n=o(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(o.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var r in n)o.d(e,r,function(t){return n[t]}.bind(null,r));return e},o.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(n,"a",n),n},o.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},o.p="",o(o.s=11)}([function(t,n){t.exports=function(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}},function(t,n,e){var o=e(0);t.exports=function(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{},r=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.forEach(function(t){o(n,t,e[t])})}return n}},function(t,n,e){var r=e(5),o=e(6),i=e(7);t.exports=function(t){return r(t)||o(t)||i()}},function(t){t.exports={a:"1.3.2"}},function(t,n,e){var r=e(8),o=e(9),i=e(10);t.exports=function(t,n){return r(t)||o(t,n)||i()}},function(t,n){t.exports=function(t){if(Array.isArray(t)){for(var n=0,e=new Array(t.length);n<t.length;n++)e[n]=t[n];return e}}},function(t,n){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,n){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,n){t.exports=function(t){if(Array.isArray(t))return t}},function(t,n){t.exports=function(t,n){var e=[],r=!0,o=!1,i=void 0;try{for(var c,u=t[Symbol.iterator]();!(r=(c=u.next()).done)&&(e.push(c.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return e}},function(t,n){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,n,e){"use strict";e.r(n);var r=e(3);var y=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 b=function(t){return"array"===o(t)};var i=function(t){return"number"===o(t)};var c=function(t){return"string"===o(t)};var a=function(t){return"object"===o(t)};var u=function(t){return"boolean"===o(t)},f=e(0),h=e.n(f),l=e(1),m=e.n(l),s=e(2),g=e.n(s);var p=function(t){return"undefined"===o(t)},d="[Circular]";var v=function(n){if(p(n))throw new Error("[chober]: nothing to clone.");var e,r,o,i;try{return JSON.parse(JSON.stringify(n))}catch(t){if(a(n)){var c=(o=n,i=Object.keys(o).reduce(function(n,e){try{return JSON.stringify(o[e]),n}catch(t){return g()(n).concat([e])}},[]).reduce(function(t,n){return m()({},t,h()({},n,d))},o),JSON.parse(JSON.stringify(i)));if(!y(c))return c}if(b(n)){var u=(r=(e=n).reduce(function(n,t,e){try{return JSON.stringify(t),n}catch(t){return g()(n).concat([e])}},[]).reduce(function(t,n){return t[n]=d,t},e),JSON.parse(JSON.stringify(r)));if(!y(u))return u}throw new Error(t)}};var w=function(t,n){return JSON.stringify(v(t))===JSON.stringify(v(n))};var O=function(t){return null==t};var j=function(t){return"function"===o(t)},S=e(4),x=e.n(S);var E=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],n=window.location.search.substr(1),i={};return""===n?{}:(0!==t.length&&(i=t.reduce(function(t,n){return m()({},t,h()({},n,[]))},{})),n.split("&").forEach(function(t){if(t){var n=t.split("="),e=x()(n,2),r=e[0],o=e[1];Object.prototype.hasOwnProperty.call(i,r)&&(b(i[r])?i[r].push(o):i[r]=[i[r],o]),b(i[r])?i[r].forEach(function(t,n){i[r][n]=decodeURIComponent(t)}):i[r]=decodeURIComponent(o)}}),i)};var C=function(t){return p(t)||!c(t)?"":String(t).replace(/\D+/g,"")};var N=function(){return window.innerWidth-document.documentElement.clientWidth};var k=function(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 n="; ".concat(document.cookie).split("; ".concat(t,"="));return 2===n.length?n.pop().split(";").shift():""};var I=function(t){if(p(t))throw new Error("[chober]: selector is not passed.");var n=document.querySelector(t).getBoundingClientRect(),e=window.pageXOffset,r=window.pageYOffset;return{x:n.left+e,y:n.top+r,left:n.left+e,top:n.top+r,right:n.right+e,bottom:n.bottom+r}};var J=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];if(!b(t))throw new Error("[chober]: param must to be an array.");return v(t).map(function(t){return JSON.stringify(t)}).filter(function(t,n,e){return e.indexOf(t)===n}).map(function(t){return JSON.parse(t)})};var T=function e(t){return b(t)?t.reduce(function(t,n){return b(n)?t.concat(e(n)):t.concat(n)},[]):[]};var R=function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=n.isSaveOld,r=void 0!==e&&e,o=n.isSaveHash,i=void 0===o||o,c=n.isSaveEmptyFields,u=void 0!==c&&c,f=Object.prototype.hasOwnProperty,a=t?Object.entries(t).reduce(function(t,n){var e=n[0],r=b(n[1])?J(T(n[1]).map(function(t){return String(t)})):n[1];return m()({},t,h()({},e,r))},{}):{},l=r&&E(),s=r&&Object.entries(a).concat(Object.entries(l)),p=i&&window.location.href.split("#")[1],d=r&&!y(l)?s.reduce(function(t,n){var e=n[0],r=n[1],o=f.call(t,e),i=f.call(l,e);if(!o||i)return o&&i?t:m()({},t,h()({},e,r));var c=t[e]===r?r:[t[e],r],u=b(t[e])?J(g()(t[e]).concat(g()(r))):c,a=b(r)?J(g()(r).concat(g()(t[e]))):u;return m()({},t,h()({},e,a))},{}):a,v=Object.keys(d).map(function(n){if("&"===n)return"";var t,e=d[n];return t=u?n?"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(e)):"":n&&e?"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(e)):"",b(e)?e.map(function(t){return u?n?"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(t)):"":n&&t?"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(t)):""}).filter(function(t){return t}).join("&"):t}).filter(function(t){return t}).join("&");window.history.pushState({},document.title,v?"?".concat(v).concat(p?"#".concat(p):""):window.location.href.split("?")[0].split("#")[0]+(p?"#".concat(p):""))};var U=function(t,n){var e=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(p(t)||p(n))throw new Error("[chober]: key or value is not passed.");var r=e&&(new Date).getTime()+e,o=e&&new Date(r).toUTCString(),i="".concat(t,"=").concat(n,"; path=/"),c="; expires=".concat(o);document.cookie=e?i:i+c};var P=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;")};var A=function(t){var n=document.createElement("textarea");return n.innerHTML=t,n.value};var _=function(t){if(p(t))throw new Error("[chober]: object is not passed.");return t&&Object.entries(t).reduce(function(t,n){return m()({},t,h()({},n[1],n[0]))},{})};var M=function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return b(t)?t.slice(0,n):[]};var D=function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:" ";return String(t||0).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g,"$1".concat(n))};var $=function(r,o){var i=this;if(!r&&!o)throw new Error("[chober]: function or delay is not passed.");var c=null;return function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];c&&clearTimeout(c),c=setTimeout(function(){r.apply(i,n),c=null},o)}};var q=function(t){if(p(t))throw new Error("[chober]: element is not passed.");t.scrollIntoView({block:"center",behavior:"smooth",inline:"end"})},H=r.a;
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("_c",[],n):"object"==typeof exports?exports._c=n():t._c=n()}("undefined"==typeof self?this:self,function(){return function(e){var r={};function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=e,o.c=r,o.d=function(t,n,e){o.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},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(n,t){if(1&t&&(n=o(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(o.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var r in n)o.d(e,r,function(t){return n[t]}.bind(null,r));return e},o.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(n,"a",n),n},o.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},o.p="",o(o.s=11)}([function(t,n){t.exports=function(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}},function(t,n,e){var o=e(0);t.exports=function(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{},r=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.forEach(function(t){o(n,t,e[t])})}return n}},function(t,n,e){var r=e(5),o=e(6),i=e(7);t.exports=function(t){return r(t)||o(t)||i()}},function(t){t.exports={a:"1.3.3"}},function(t,n,e){var r=e(8),o=e(9),i=e(10);t.exports=function(t,n){return r(t)||o(t,n)||i()}},function(t,n){t.exports=function(t){if(Array.isArray(t)){for(var n=0,e=new Array(t.length);n<t.length;n++)e[n]=t[n];return e}}},function(t,n){t.exports=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}},function(t,n){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(t,n){t.exports=function(t){if(Array.isArray(t))return t}},function(t,n){t.exports=function(t,n){var e=[],r=!0,o=!1,i=void 0;try{for(var c,u=t[Symbol.iterator]();!(r=(c=u.next()).done)&&(e.push(c.value),!n||e.length!==n);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return e}},function(t,n){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,n,e){"use strict";e.r(n);var r=e(3);var y=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 b=function(t){return"array"===o(t)};var i=function(t){return"number"===o(t)};var c=function(t){return"string"===o(t)};var a=function(t){return"object"===o(t)};var u=function(t){return"boolean"===o(t)},f=e(0),h=e.n(f),l=e(1),m=e.n(l),s=e(2),g=e.n(s);var p=function(t){return"undefined"===o(t)},d="[Circular]";var v=function(n){if(p(n))throw new Error("[chober]: nothing to clone.");var e,r,o,i;try{return JSON.parse(JSON.stringify(n))}catch(t){if(a(n)){var c=(o=n,i=Object.keys(o).reduce(function(n,e){try{return JSON.stringify(o[e]),n}catch(t){return g()(n).concat([e])}},[]).reduce(function(t,n){return m()({},t,h()({},n,d))},o),JSON.parse(JSON.stringify(i)));if(!y(c))return c}if(b(n)){var u=(r=(e=n).reduce(function(n,t,e){try{return JSON.stringify(t),n}catch(t){return g()(n).concat([e])}},[]).reduce(function(t,n){return t[n]=d,t},e),JSON.parse(JSON.stringify(r)));if(!y(u))return u}throw new Error(t)}};var w=function(t,n){return JSON.stringify(v(t))===JSON.stringify(v(n))};var O=function(t){return null==t};var S=function(t){return"function"===o(t)},j=e(4),x=e.n(j);var E=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],n=window.location.search.substr(1),i={};return""===n?{}:(0!==t.length&&(i=t.reduce(function(t,n){return m()({},t,h()({},n,[]))},{})),n.split("&").forEach(function(t){if(t){var n=t.split("="),e=x()(n,2),r=e[0],o=e[1];Object.prototype.hasOwnProperty.call(i,r)&&(b(i[r])?i[r].push(o):i[r]=[i[r],o]),b(i[r])?i[r].forEach(function(t,n){i[r][n]=decodeURIComponent(t)}):i[r]=decodeURIComponent(o)}}),i)};var C=function(t){return p(t)||!c(t)?"":String(t).replace(/\D+/g,"")};var N=function(){return window.innerWidth-document.documentElement.clientWidth};var k=function(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 n="; ".concat(document.cookie).split("; ".concat(t,"="));return 2===n.length?n.pop().split(";").shift():""};var I=function(t){if(p(t))throw new Error("[chober]: item is not passed.");var n=(c(t)?document.querySelector(t):t).getBoundingClientRect(),e=window.pageXOffset,r=window.pageYOffset;return{x:n.left+e,y:n.top+r,left:n.left+e,top:n.top+r,right:n.right+e,bottom:n.bottom+r}};var J=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];if(!b(t))throw new Error("[chober]: param must to be an array.");return v(t).map(function(t){return JSON.stringify(t)}).filter(function(t,n,e){return e.indexOf(t)===n}).map(function(t){return JSON.parse(t)})};var T=function e(t){return b(t)?t.reduce(function(t,n){return b(n)?t.concat(e(n)):t.concat(n)},[]):[]};var R=function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=n.isSaveOld,r=void 0!==e&&e,o=n.isSaveHash,i=void 0===o||o,c=n.isSaveEmptyFields,u=void 0!==c&&c,f=Object.prototype.hasOwnProperty,a=t?Object.entries(t).reduce(function(t,n){var e=n[0],r=b(n[1])?J(T(n[1]).map(function(t){return String(t)})):n[1];return m()({},t,h()({},e,r))},{}):{},l=r&&E(),s=r&&Object.entries(a).concat(Object.entries(l)),p=i&&window.location.href.split("#")[1],d=r&&!y(l)?s.reduce(function(t,n){var e=n[0],r=n[1],o=f.call(t,e),i=f.call(l,e);if(!o||i)return o&&i?t:m()({},t,h()({},e,r));var c=t[e]===r?r:[t[e],r],u=b(t[e])?J(g()(t[e]).concat(g()(r))):c,a=b(r)?J(g()(r).concat(g()(t[e]))):u;return m()({},t,h()({},e,a))},{}):a,v=Object.keys(d).map(function(n){if("&"===n)return"";var t,e=d[n];return t=u?n?"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(e)):"":n&&e?"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(e)):"",b(e)?e.map(function(t){return u?n?"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(t)):"":n&&t?"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(t)):""}).filter(function(t){return t}).join("&"):t}).filter(function(t){return t}).join("&");window.history.pushState({},document.title,v?"?".concat(v).concat(p?"#".concat(p):""):window.location.href.split("?")[0].split("#")[0]+(p?"#".concat(p):""))};var U=function(t,n){var e=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(p(t)||p(n))throw new Error("[chober]: key or value is not passed.");var r=e&&(new Date).getTime()+e,o=e&&new Date(r).toUTCString(),i="".concat(t,"=").concat(n,"; path=/"),c="; expires=".concat(o);document.cookie=e?i:i+c};var P=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;")};var A=function(t){var n=document.createElement("textarea");return n.innerHTML=t,n.value};var _=function(t){if(p(t))throw new Error("[chober]: object is not passed.");return t&&Object.entries(t).reduce(function(t,n){return m()({},t,h()({},n[1],n[0]))},{})};var M=function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return b(t)?t.slice(0,n):[]};var D=function(t){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:" ";return String(t||0).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g,"$1".concat(n))};var q=function(r,o){var i=this;if(!r&&!o)throw new Error("[chober]: function or delay is not passed.");var c=null;return function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];c&&clearTimeout(c),c=setTimeout(function(){r.apply(i,n),c=null},o)}};var $=function(t){if(p(t))throw new Error("[chober]: item is not passed.");(c(t)?document.querySelector(t):t).scrollIntoView({block:"center",behavior:"smooth",inline:"end"})},H=r.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
*/n.default={VERSION:H,isEmpty:y,isArray:b,isNumber:i,isString:c,isObject:a,isBoolean:u,isEqual:w,isUndefined:p,isNil:O,isFunction:j,getQuery:E,getNumbers:C,getScrollbarWidth:N,getCookie:k,getOffset:I,getType:o,setQuery:R,setCookie:U,removeCookie:P,decodeHtml:A,clone:v,invertObject:_,first:M,flattenDeep:T,formatNumber:D,debounce:$,scrollTo:q,uniq:J}}]).default});
*/n.default={VERSION:H,isEmpty:y,isArray:b,isNumber:i,isString:c,isObject:a,isBoolean:u,isEqual:w,isUndefined:p,isNil:O,isFunction:S,getQuery:E,getNumbers:C,getScrollbarWidth:N,getCookie:k,getOffset:I,getType:o,setQuery:R,setCookie:U,removeCookie:P,decodeHtml:A,clone:v,invertObject:_,first:M,flattenDeep:T,formatNumber:D,debounce:q,scrollTo:$,uniq:J}}]).default});

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

#### Params
- `selector`
- `item`
- Type: `String`

@@ -628,3 +628,3 @@ - Description: *Selector of HTML element to get coordinates of.*

#### Params
- `element`
- `item`
- Type: `DOMElement`

@@ -631,0 +631,0 @@ - Description: *Element to which to scroll.*

import isUndefined from './isUndefined';
import isString from './isString';

@@ -7,3 +8,3 @@ /**

* @since 0.1.0
* @param {String} selector Selector of HTML element to get coordinates of.
* @param {String} item Selector or HTML element to get coordinates of.
* @returns {Object}

@@ -15,8 +16,10 @@ *

*/
function getOffset(selector) {
if (isUndefined(selector)) {
throw new Error('[chober]: selector is not passed.');
function getOffset(item) {
if (isUndefined(item)) {
throw new Error('[chober]: item is not passed.');
}
const element = document.querySelector(selector);
const element = isString(item)
? document.querySelector(item)
: item;
const rect = element.getBoundingClientRect();

@@ -23,0 +26,0 @@ const scrollLeft = window.pageXOffset;

import isUndefined from './isUndefined';
import isString from './isString';

@@ -7,3 +8,3 @@ /**

* @since 0.2.0
* @param {DOMElement} element Element to which to scroll.
* @param {DOMElement} item Selector or HTML element to which to scroll.
*

@@ -13,10 +14,11 @@ * @example

*/
function scrollTo(element) {
if (isUndefined(element)) {
throw new Error('[chober]: element is not passed.');
function scrollTo(item) {
if (isUndefined(item)) {
throw new Error('[chober]: item is not passed.');
}
element.scrollIntoView({ block: 'center', behavior: 'smooth', inline: 'end' });
(isString(item) ? document.querySelector(item) : item)
.scrollIntoView({ block: 'center', behavior: 'smooth', inline: 'end' });
}
export default scrollTo;
{
"name": "chober",
"version": "1.3.2",
"version": "1.3.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.",

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

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