Comparing version 1.2.1 to 1.2.2
@@ -103,3 +103,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
\******************/ | ||
/*! exports provided: VERSION, isEmpty, isArray, isNumber, isString, isObject, isBoolean, isEqual, isUndefined, getQuery, getNumbers, getScrollbarWidth, getCookie, getOffset, getType, setQuery, setCookie, removeCookie, decodeHtml, clone, invertObject, first, flatten, formatNumber, debounce, scrollTo, uniq, default */ | ||
/*! exports provided: VERSION, isEmpty, isArray, isNumber, isString, isObject, isBoolean, isEqual, isUndefined, getQuery, getNumbers, getScrollbarWidth, getCookie, getOffset, getType, setQuery, setCookie, removeCookie, decodeHtml, clone, invertObject, first, flattenDeep, formatNumber, debounce, scrollTo, uniq, default */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -179,4 +179,4 @@ | ||
/* harmony import */ var _lib_flatten__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./lib/flatten */ "./lib/flatten.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return _lib_flatten__WEBPACK_IMPORTED_MODULE_24__["default"]; }); | ||
/* harmony import */ var _lib_flattenDeep__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./lib/flattenDeep */ "./lib/flattenDeep.js"); | ||
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flattenDeep", function() { return _lib_flattenDeep__WEBPACK_IMPORTED_MODULE_24__["default"]; }); | ||
@@ -279,3 +279,3 @@ /* harmony import */ var _lib_formatNumber__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./lib/formatNumber */ "./lib/formatNumber.js"); | ||
first: _lib_first__WEBPACK_IMPORTED_MODULE_23__["default"], | ||
flatten: _lib_flatten__WEBPACK_IMPORTED_MODULE_24__["default"], | ||
flattenDeep: _lib_flattenDeep__WEBPACK_IMPORTED_MODULE_24__["default"], | ||
formatNumber: _lib_formatNumber__WEBPACK_IMPORTED_MODULE_25__["default"], | ||
@@ -507,6 +507,6 @@ debounce: _lib_debounce__WEBPACK_IMPORTED_MODULE_26__["default"], | ||
/***/ "./lib/flatten.js": | ||
/*!************************!*\ | ||
!*** ./lib/flatten.js ***! | ||
\************************/ | ||
/***/ "./lib/flattenDeep.js": | ||
/*!****************************!*\ | ||
!*** ./lib/flattenDeep.js ***! | ||
\****************************/ | ||
/*! exports provided: default */ | ||
@@ -527,10 +527,10 @@ /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
* @example | ||
* flatten([123, [456, [567, [890]]]]) | ||
* flattenDeep([123, [456, [567, [890]]]]) | ||
* // => [123, 456, 567, 890] | ||
*/ | ||
function flatten(array) { | ||
function flattenDeep(array) { | ||
if (Object(_isArray__WEBPACK_IMPORTED_MODULE_0__["default"])(array)) { | ||
return array.reduce(function (acc, value) { | ||
return Object(_isArray__WEBPACK_IMPORTED_MODULE_0__["default"])(value) ? acc.concat(flatten(value)) : acc.concat(value); | ||
return Object(_isArray__WEBPACK_IMPORTED_MODULE_0__["default"])(value) ? acc.concat(flattenDeep(value)) : acc.concat(value); | ||
}, []); | ||
@@ -542,3 +542,3 @@ } | ||
/* harmony default export */ __webpack_exports__["default"] = (flatten); | ||
/* harmony default export */ __webpack_exports__["default"] = (flattenDeep); | ||
@@ -1298,3 +1298,3 @@ /***/ }), | ||
/* harmony import */ var _uniq__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./uniq */ "./lib/uniq.js"); | ||
/* harmony import */ var _flatten__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flatten */ "./lib/flatten.js"); | ||
/* harmony import */ var _flattenDeep__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flattenDeep */ "./lib/flattenDeep.js"); | ||
@@ -1345,3 +1345,3 @@ | ||
var fieldName = field[0]; | ||
var fieldValue = Object(_isArray__WEBPACK_IMPORTED_MODULE_4__["default"])(field[1]) ? Object(_uniq__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_flatten__WEBPACK_IMPORTED_MODULE_6__["default"])(field[1]).map(function (value) { | ||
var fieldValue = Object(_isArray__WEBPACK_IMPORTED_MODULE_4__["default"])(field[1]) ? Object(_uniq__WEBPACK_IMPORTED_MODULE_5__["default"])(Object(_flattenDeep__WEBPACK_IMPORTED_MODULE_6__["default"])(field[1]).map(function (value) { | ||
return String(value); | ||
@@ -1641,3 +1641,3 @@ })) : field[1]; | ||
module.exports = {"name":"chober","version":"1.2.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.","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","isEqual","isUndefined","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.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.23.1","webpack-cli":"^3.1.2"}}; | ||
module.exports = {"name":"chober","version":"1.2.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.js.git"},"keywords":["webpack","js","javascript","library","es6","commonjs","methods","chober","isEmpty","isArray","isNumber","isString","isObject","isBoolean","isEqual","isUndefined","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.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.23.1","webpack-cli":"^3.1.2"}}; | ||
@@ -1644,0 +1644,0 @@ /***/ }) |
@@ -1,2 +0,2 @@ | ||
!function webpackUniversalModuleDefinition(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 function(n){var r={};function __webpack_require__(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,__webpack_require__),t.l=!0,t.exports}return __webpack_require__.m=n,__webpack_require__.c=r,__webpack_require__.d=function(e,t,n){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},__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(t,e){if(1&e&&(t=__webpack_require__(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(__webpack_require__.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)__webpack_require__.d(n,r,function(e){return t[e]}.bind(null,r));return n},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=9)}([function(e,t){e.exports=function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var o=n(0);e.exports=function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(e){o(t,e,n[e])})}return t}},function(e,t){function _extends(){return e.exports=_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_extends.apply(this,arguments)}e.exports=_extends},function(e,t,n){var r=n(6),o=n(7),i=n(8);e.exports=function _toConsumableArray(e){return r(e)||o(e)||i()}},function(e,t){e.exports=function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e){e.exports={a:"1.2.1"}},function(e,t){e.exports=function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t,n){"use strict";n.r(t);var r=n(2),o=n.n(r),i=n(4),c=n.n(i),u=n(5);var _=function isEmpty(e){return!(e&&(e.length||Object.keys(e).length))};var a=function getType(e){return Object.prototype.toString.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase()};var v=function isArray(e){return"array"===a(e)};var f=function isNumber(e){return"number"===a(e)};var s=function isString(e){return"string"===a(e)};var l=function isObject(e){return"object"===a(e)};var d=function isBoolean(e){return"boolean"===a(e)},p=n(0),y=n.n(p),b=n(1),h=n.n(b),m=n(3),g=n.n(m);var w=function isUndefined(e){return"undefined"===a(e)},O="[Circular]";var j=function clone(t){if(w(t))throw new Error("[chober]: nothing to clone.");try{return JSON.parse(JSON.stringify(t))}catch(e){if(l(t)){var n=function objectClone(e){var t=Object.keys(e).reduce(function(t,n){try{return JSON.stringify(e[n]),t}catch(e){return g()(t).concat([n])}},[]).reduce(function(e,t){return h()({},e,y()({},t,O))},e);return JSON.parse(JSON.stringify(t))}(t);if(!_(n))return n}if(v(t)){var r=function arrayClone(e){var t=e.reduce(function(t,e,n){try{return JSON.stringify(e),t}catch(e){return g()(t).concat([n])}},[]).reduce(function(e,t){return e[t]=O,e},e);return JSON.parse(JSON.stringify(t))}(t);if(!_(r))return r}throw new Error(e)}};var S=function isEqual(e,t){return JSON.stringify(j(e))===JSON.stringify(j(t))};var k=function getQuery(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=window.location.search.substr(1),r={};return t?(e.length&&o()(r,e.reduce(function(e,t){return h()({},e,y()({},t,[]))},{})),t.split("&").forEach(function(e){if(e){var n=e.split("=");Object.prototype.hasOwnProperty.call(r,n[0])&&(v(r[n[0]])?r[n[0]].push(n[1]):r[n[0]]=[r[n[0]],n[1]]),v(r[n[0]])?r[n[0]].forEach(function(e,t){r[n[0]][t]=decodeURIComponent(e)}):r[n[0]]=decodeURIComponent(n[1])}}),r):{}};var C=function getNumbers(e){return w(e)||!s(e)?"":String(e).replace(/\D+/g,"")};var x=function getScrollbarWidth(){return window.innerWidth-document.documentElement.clientWidth};var E=function getCookie(e){if(w(e))throw new Error("[chober]: key is not passed.");if(!s(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():""};var q=function getOffset(e){if(w(e))throw new Error("[chober]: selector is not passed.");var t=document.querySelector(e).getBoundingClientRect(),n=window.pageXOffset,r=window.pageYOffset;return{x:t.left+n,y:t.top+r,left:t.left+n,top:t.top+r,right:t.right+n,bottom:t.bottom+r}};var N=function uniq(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];if(!v(e))throw new Error("[chober]: param must to be an array.");return j(e).map(function(e){return JSON.stringify(e)}).filter(function(e,t,n){return n.indexOf(e)===t}).map(function(e){return JSON.parse(e)})};var T=function flatten(e){return v(e)?e.reduce(function(e,t){return v(t)?e.concat(flatten(t)):e.concat(t)},[]):[]};var I=function setQuery(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=t.isSaveOld,r=void 0!==n&&n,o=t.isSaveHash,i=void 0===o||o,c=t.isSaveEmptyFields,u=void 0!==c&&c,f=Object.prototype.hasOwnProperty,a=e?Object.entries(e).reduce(function(e,t){var n=t[0],r=v(t[1])?N(T(t[1]).map(function(e){return String(e)})):t[1];return h()({},e,y()({},n,r))},{}):{},s=r&&k(),l=r&&Object.entries(a).concat(Object.entries(s)),d=i&&window.location.href.split("#")[1],p=r&&!_(s)?l.reduce(function(e,t){var n=t[0],r=t[1],o=f.call(e,n),i=f.call(s,n);if(!o||i)return o&&i?e:h()({},e,y()({},n,r));var c=e[n]===r?r:[e[n],r],u=v(e[n])?N(e[n].concat(r)):c,a=v(r)?N(r.concat(e[n])):u;return h()({},e,y()({},n,a))},{}):a,b=Object.keys(p).map(function(t){if("&"===t)return"";var e,n=p[t];return e=u?t?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n)):"":t&&n?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n)):"",v(n)?n.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,b?"?".concat(decodeURIComponent(b)).concat(d?"#".concat(d):""):window.location.href.split("?")[0].split("#")[0]+(d?"#".concat(d):""))};var U=function setCookie(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(w(e)||w(t))throw new Error("[chober]: key or value is not passed.");var r=n&&(new Date).getTime()+n,o=n&&new Date(r).toUTCString(),i="".concat(e,"=").concat(t,"; path=/"),c="; expires=".concat(o);document.cookie=n?i:i+c};var R=function removeCookie(e){if(w(e))throw new Error("[chober]: key is not passed.");document.cookie="".concat(e,"=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;")};var J=function decodeHtml(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value};var P=function invertObject(e){if(w(e))throw new Error("[chober]: object is not passed.");return e&&Object.entries(e).reduce(function(e,t){return h()({},e,y()({},t[1],t[0]))},{})};var A=function first(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return v(e)?e.slice(0,t):[]};var M=function formatNumber(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))};var D=function debounce(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 e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];c&&clearTimeout(c),c=setTimeout(function onComplete(){r.apply(i,t),c=null},o)}};var H=function scrollTo(e){if(w(e))throw new Error("[chober]: element is not passed.");e.scrollIntoView({behavior:"smooth"})};n.d(t,"VERSION",function(){return Q}),n.d(t,"isEmpty",function(){return _}),n.d(t,"isArray",function(){return v}),n.d(t,"isNumber",function(){return f}),n.d(t,"isString",function(){return s}),n.d(t,"isObject",function(){return l}),n.d(t,"isBoolean",function(){return d}),n.d(t,"isEqual",function(){return S}),n.d(t,"isUndefined",function(){return w}),n.d(t,"getQuery",function(){return k}),n.d(t,"getNumbers",function(){return C}),n.d(t,"getScrollbarWidth",function(){return x}),n.d(t,"getCookie",function(){return E}),n.d(t,"getOffset",function(){return q}),n.d(t,"getType",function(){return a}),n.d(t,"setQuery",function(){return I}),n.d(t,"setCookie",function(){return U}),n.d(t,"removeCookie",function(){return R}),n.d(t,"decodeHtml",function(){return J}),n.d(t,"clone",function(){return j}),n.d(t,"invertObject",function(){return P}),n.d(t,"first",function(){return A}),n.d(t,"flatten",function(){return T}),n.d(t,"formatNumber",function(){return M}),n.d(t,"debounce",function(){return D}),n.d(t,"scrollTo",function(){return H}),n.d(t,"uniq",function(){return N}); | ||
!function webpackUniversalModuleDefinition(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 function(n){var r={};function __webpack_require__(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,__webpack_require__),t.l=!0,t.exports}return __webpack_require__.m=n,__webpack_require__.c=r,__webpack_require__.d=function(e,t,n){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},__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(t,e){if(1&e&&(t=__webpack_require__(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(__webpack_require__.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)__webpack_require__.d(n,r,function(e){return t[e]}.bind(null,r));return n},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=9)}([function(e,t){e.exports=function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var o=n(0);e.exports=function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(e){o(t,e,n[e])})}return t}},function(e,t){function _extends(){return e.exports=_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_extends.apply(this,arguments)}e.exports=_extends},function(e,t,n){var r=n(6),o=n(7),i=n(8);e.exports=function _toConsumableArray(e){return r(e)||o(e)||i()}},function(e,t){e.exports=function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e){e.exports={a:"1.2.2"}},function(e,t){e.exports=function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t,n){"use strict";n.r(t);var r=n(2),o=n.n(r),i=n(4),c=n.n(i),u=n(5);var _=function isEmpty(e){return!(e&&(e.length||Object.keys(e).length))};var a=function getType(e){return Object.prototype.toString.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase()};var v=function isArray(e){return"array"===a(e)};var f=function isNumber(e){return"number"===a(e)};var s=function isString(e){return"string"===a(e)};var l=function isObject(e){return"object"===a(e)};var d=function isBoolean(e){return"boolean"===a(e)},p=n(0),y=n.n(p),b=n(1),h=n.n(b),m=n(3),g=n.n(m);var w=function isUndefined(e){return"undefined"===a(e)},O="[Circular]";var j=function clone(t){if(w(t))throw new Error("[chober]: nothing to clone.");try{return JSON.parse(JSON.stringify(t))}catch(e){if(l(t)){var n=function objectClone(e){var t=Object.keys(e).reduce(function(t,n){try{return JSON.stringify(e[n]),t}catch(e){return g()(t).concat([n])}},[]).reduce(function(e,t){return h()({},e,y()({},t,O))},e);return JSON.parse(JSON.stringify(t))}(t);if(!_(n))return n}if(v(t)){var r=function arrayClone(e){var t=e.reduce(function(t,e,n){try{return JSON.stringify(e),t}catch(e){return g()(t).concat([n])}},[]).reduce(function(e,t){return e[t]=O,e},e);return JSON.parse(JSON.stringify(t))}(t);if(!_(r))return r}throw new Error(e)}};var S=function isEqual(e,t){return JSON.stringify(j(e))===JSON.stringify(j(t))};var k=function getQuery(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=window.location.search.substr(1),r={};return t?(e.length&&o()(r,e.reduce(function(e,t){return h()({},e,y()({},t,[]))},{})),t.split("&").forEach(function(e){if(e){var n=e.split("=");Object.prototype.hasOwnProperty.call(r,n[0])&&(v(r[n[0]])?r[n[0]].push(n[1]):r[n[0]]=[r[n[0]],n[1]]),v(r[n[0]])?r[n[0]].forEach(function(e,t){r[n[0]][t]=decodeURIComponent(e)}):r[n[0]]=decodeURIComponent(n[1])}}),r):{}};var C=function getNumbers(e){return w(e)||!s(e)?"":String(e).replace(/\D+/g,"")};var x=function getScrollbarWidth(){return window.innerWidth-document.documentElement.clientWidth};var E=function getCookie(e){if(w(e))throw new Error("[chober]: key is not passed.");if(!s(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():""};var q=function getOffset(e){if(w(e))throw new Error("[chober]: selector is not passed.");var t=document.querySelector(e).getBoundingClientRect(),n=window.pageXOffset,r=window.pageYOffset;return{x:t.left+n,y:t.top+r,left:t.left+n,top:t.top+r,right:t.right+n,bottom:t.bottom+r}};var N=function uniq(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];if(!v(e))throw new Error("[chober]: param must to be an array.");return j(e).map(function(e){return JSON.stringify(e)}).filter(function(e,t,n){return n.indexOf(e)===t}).map(function(e){return JSON.parse(e)})};var T=function flattenDeep(e){return v(e)?e.reduce(function(e,t){return v(t)?e.concat(flattenDeep(t)):e.concat(t)},[]):[]};var I=function setQuery(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=t.isSaveOld,r=void 0!==n&&n,o=t.isSaveHash,i=void 0===o||o,c=t.isSaveEmptyFields,u=void 0!==c&&c,f=Object.prototype.hasOwnProperty,a=e?Object.entries(e).reduce(function(e,t){var n=t[0],r=v(t[1])?N(T(t[1]).map(function(e){return String(e)})):t[1];return h()({},e,y()({},n,r))},{}):{},s=r&&k(),l=r&&Object.entries(a).concat(Object.entries(s)),d=i&&window.location.href.split("#")[1],p=r&&!_(s)?l.reduce(function(e,t){var n=t[0],r=t[1],o=f.call(e,n),i=f.call(s,n);if(!o||i)return o&&i?e:h()({},e,y()({},n,r));var c=e[n]===r?r:[e[n],r],u=v(e[n])?N(e[n].concat(r)):c,a=v(r)?N(r.concat(e[n])):u;return h()({},e,y()({},n,a))},{}):a,b=Object.keys(p).map(function(t){if("&"===t)return"";var e,n=p[t];return e=u?t?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n)):"":t&&n?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n)):"",v(n)?n.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,b?"?".concat(decodeURIComponent(b)).concat(d?"#".concat(d):""):window.location.href.split("?")[0].split("#")[0]+(d?"#".concat(d):""))};var U=function setCookie(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(w(e)||w(t))throw new Error("[chober]: key or value is not passed.");var r=n&&(new Date).getTime()+n,o=n&&new Date(r).toUTCString(),i="".concat(e,"=").concat(t,"; path=/"),c="; expires=".concat(o);document.cookie=n?i:i+c};var R=function removeCookie(e){if(w(e))throw new Error("[chober]: key is not passed.");document.cookie="".concat(e,"=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;")};var J=function decodeHtml(e){var t=document.createElement("textarea");return t.innerHTML=e,t.value};var P=function invertObject(e){if(w(e))throw new Error("[chober]: object is not passed.");return e&&Object.entries(e).reduce(function(e,t){return h()({},e,y()({},t[1],t[0]))},{})};var A=function first(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return v(e)?e.slice(0,t):[]};var D=function formatNumber(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))};var M=function debounce(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 e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];c&&clearTimeout(c),c=setTimeout(function onComplete(){r.apply(i,t),c=null},o)}};var H=function scrollTo(e){if(w(e))throw new Error("[chober]: element is not passed.");e.scrollIntoView({behavior:"smooth"})};n.d(t,"VERSION",function(){return Q}),n.d(t,"isEmpty",function(){return _}),n.d(t,"isArray",function(){return v}),n.d(t,"isNumber",function(){return f}),n.d(t,"isString",function(){return s}),n.d(t,"isObject",function(){return l}),n.d(t,"isBoolean",function(){return d}),n.d(t,"isEqual",function(){return S}),n.d(t,"isUndefined",function(){return w}),n.d(t,"getQuery",function(){return k}),n.d(t,"getNumbers",function(){return C}),n.d(t,"getScrollbarWidth",function(){return x}),n.d(t,"getCookie",function(){return E}),n.d(t,"getOffset",function(){return q}),n.d(t,"getType",function(){return a}),n.d(t,"setQuery",function(){return I}),n.d(t,"setCookie",function(){return U}),n.d(t,"removeCookie",function(){return R}),n.d(t,"decodeHtml",function(){return J}),n.d(t,"clone",function(){return j}),n.d(t,"invertObject",function(){return P}),n.d(t,"first",function(){return A}),n.d(t,"flattenDeep",function(){return T}),n.d(t,"formatNumber",function(){return D}),n.d(t,"debounce",function(){return M}),n.d(t,"scrollTo",function(){return H}),n.d(t,"uniq",function(){return N}); | ||
/** | ||
@@ -10,2 +10,2 @@ * Chober.js - is a collection of useful methods that are used by programmers every day. | ||
*/ | ||
var Q=u.a;t.default=new function Chober(){c()(this,Chober),o()(this,{VERSION:Q,isEmpty:_,isArray:v,isNumber:f,isString:s,isObject:l,isBoolean:d,isEqual:S,isUndefined:w,getQuery:k,getNumbers:C,getScrollbarWidth:x,getCookie:E,getOffset:q,getType:a,setQuery:I,setCookie:U,removeCookie:R,decodeHtml:J,clone:j,invertObject:P,first:A,flatten:T,formatNumber:M,debounce:D,scrollTo:H,uniq:N})}}])}); | ||
var Q=u.a;t.default=new function Chober(){c()(this,Chober),o()(this,{VERSION:Q,isEmpty:_,isArray:v,isNumber:f,isString:s,isObject:l,isBoolean:d,isEqual:S,isUndefined:w,getQuery:k,getNumbers:C,getScrollbarWidth:x,getCookie:E,getOffset:q,getType:a,setQuery:I,setCookie:U,removeCookie:R,decodeHtml:J,clone:j,invertObject:P,first:A,flattenDeep:T,formatNumber:D,debounce:M,scrollTo:H,uniq:N})}}])}); |
![logo](_media/logo.png) | ||
# Chober <small>1.2.1</small> | ||
# Chober <small>1.2.2</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.2.1/dist/chober.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/chober@1.2.2/dist/chober.min.js"></script> | ||
``` | ||
@@ -204,3 +204,3 @@ | ||
* * * | ||
### flatten | ||
### flattenDeep | ||
@@ -222,6 +222,6 @@ Flatten an array. | ||
```JS | ||
flatten([123, [456, [567, [890]]]]) | ||
flattenDeep([123, [456, [567, [890]]]]) | ||
// => [123, 456, 567, 890] | ||
``` | ||
<a href="https://github.com/BrooonS/chober/blob/master/lib/flatten.js" target="_blank">Source code</a> | ||
<a href="https://github.com/BrooonS/chober/blob/master/lib/flattenDeep.js" target="_blank">Source code</a> | ||
* * * | ||
@@ -228,0 +228,0 @@ ### formatNumber |
@@ -36,3 +36,3 @@ /** | ||
import first from './lib/first'; | ||
import flatten from './lib/flatten'; | ||
import flattenDeep from './lib/flattenDeep'; | ||
import formatNumber from './lib/formatNumber'; | ||
@@ -76,3 +76,3 @@ import debounce from './lib/debounce'; | ||
first, | ||
flatten, | ||
flattenDeep, | ||
formatNumber, | ||
@@ -112,3 +112,3 @@ debounce, | ||
first, | ||
flatten, | ||
flattenDeep, | ||
formatNumber, | ||
@@ -115,0 +115,0 @@ debounce, |
@@ -5,3 +5,3 @@ import getQuery from './getQuery'; | ||
import uniq from './uniq'; | ||
import flatten from './flatten'; | ||
import flattenDeep from './flattenDeep'; | ||
@@ -44,3 +44,3 @@ /** | ||
const fieldValue = isArray(field[1]) | ||
? uniq(flatten(field[1]).map(value => String(value))) | ||
? uniq(flattenDeep(field[1]).map(value => String(value))) | ||
: field[1]; | ||
@@ -47,0 +47,0 @@ |
{ | ||
"name": "chober", | ||
"version": "1.2.1", | ||
"version": "1.2.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.", | ||
@@ -5,0 +5,0 @@ "main": "dist/chober.js", |
@@ -32,3 +32,3 @@ # Chober.js | ||
<!-- With version --> | ||
<script src="https://cdn.jsdelivr.net/npm/chober@1.2.1/dist/chober.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/chober@1.2.2/dist/chober.min.js"></script> | ||
``` | ||
@@ -35,0 +35,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
237067