@sajari/react-sdk-utils
Advanced tools
Comparing version 1.2.2 to 1.3.0
# Change Log | ||
## 1.3.0 | ||
### Minor Changes | ||
- [`8c2939af`](https://github.com/sajari/sdk-react/commit/8c2939af3a9249e20da93c2ed8f37769207b7688) [#323](https://github.com/sajari/sdk-react/pull/323) Thanks [@sampotts](https://github.com/sampotts)! - Added support for ARRAY_MATCH filter expression function | ||
## 1.2.2 | ||
@@ -4,0 +10,0 @@ |
@@ -0,1 +1,2 @@ | ||
export * from './array'; | ||
export * from './assertion'; | ||
@@ -2,0 +3,0 @@ export * from './constant'; |
@@ -0,1 +1,2 @@ | ||
export { groupBy } from './array.esm.js'; | ||
export { isArray, isBoolean, isEmpty, isEmptyArray, isEmptyObject, isFunction, isNullOrUndefined, isNumber, isObject, isString, isValidURL } from './assertion.esm.js'; | ||
@@ -2,0 +3,0 @@ export { __DEV__ } from './constant.esm.js'; |
@@ -0,3 +1,3 @@ | ||
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from './_virtual/_rollupPluginBabelHelpers.js'; | ||
import { isNumber } from './assertion.esm.js'; | ||
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from './_virtual/_rollupPluginBabelHelpers.js'; | ||
import { isSSR } from './ssr.esm.js'; | ||
@@ -4,0 +4,0 @@ |
@@ -0,3 +1,3 @@ | ||
import { extends as _extends } from './_virtual/_rollupPluginBabelHelpers.js'; | ||
import { isObject } from './assertion.esm.js'; | ||
import { extends as _extends } from './_virtual/_rollupPluginBabelHelpers.js'; | ||
@@ -4,0 +4,0 @@ function filterObject(input, keys, invert) { |
@@ -13,2 +13,43 @@ 'use strict'; | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function groupBy(collection, key) { | ||
return collection.reduce(function (out, obj) { | ||
var _extends2; | ||
return _extends({}, out, (_extends2 = {}, _extends2[obj[key]] = (out[obj[key]] || []).concat(obj), _extends2)); | ||
}, {}); | ||
} | ||
function parseURL(url) { | ||
@@ -164,35 +205,2 @@ if (url === void 0) { | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (source == null) return {}; | ||
var target = {}; | ||
var sourceKeys = Object.keys(source); | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
key = sourceKeys[i]; | ||
if (excluded.indexOf(key) >= 0) continue; | ||
target[key] = source[key]; | ||
} | ||
return target; | ||
} | ||
function isSSR() { | ||
@@ -556,2 +564,3 @@ return typeof window === 'undefined'; | ||
exports.getStylesObject = getStylesObject; | ||
exports.groupBy = groupBy; | ||
exports.inferStylesObjectKeys = inferStylesObjectKeys; | ||
@@ -558,0 +567,0 @@ exports.isArray = isArray; |
@@ -1,2 +0,2 @@ | ||
"use strict";function r(r){return r&&"object"==typeof r&&"default"in r?r.default:r}var e=require("react"),t=r(e),n=require("@emotion/core"),i=r(require("@emotion/is-prop-valid")),o=r(require("@emotion/styled")),u=require("emotion-theming"),a=r(require("@emotion/cache"));function s(r){return null==r}function c(r){return"string"==typeof r}function f(r){return"number"==typeof r&&!Number.isNaN(r)}function l(r){return Array.isArray(r)}var p=function(r){var e=typeof r;return null!==r&&("object"===e||"function"===e)&&!l(r)},d=function(r){return l(r)&&0===r.length},m=function(r){return p(r)&&0===Object.keys(r).length},v=function(r){return!!s(r)||(l(r)?d(r):p(r)?m(r):!!c(r)&&""===r.trim())};function x(){return(x=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r}).apply(this,arguments)}function h(){return"undefined"==typeof window}function y(r){var e=/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/.exec(r.toString());return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0}function b(r,e){var t=e.neutral,n=void 0===t||t,i=e.language,o=void 0===i?h()?"en-US":navigator.language:i,u=function(r,e){if(null==r)return{};var t,n,i={},o=Object.keys(r);for(n=0;n<o.length;n++)e.indexOf(t=o[n])>=0||(i[t]=r[t]);return i}(e,["neutral","language"]);return f(r)?new Intl.NumberFormat(n?o.split("-")[0]:o,u).format(r):r}function g(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];if(!p(r)||!t.length)return r;var i=t.shift();return i&&p(i)?(Object.keys(i).forEach((function(e){var t=r[e],n=i[e];r[e]=Array.isArray(t)&&Array.isArray(n)?t.concat(n):p(t)&&p(n)?g(x({},t),n):n})),r):r}function w(r,e){void 0===r&&(r=null),r&&("function"==typeof r?r(e):r.current=e)}function O(r,e){if(null!=r)try{w(r,e)}catch(r){throw new Error("Cannot assign value to ref")}}function j(r,e,t){return c(e)?r.split(e).join(t):Object.entries(e).reduce((function(r,e){return j(r,e[0],e[1])}),r)}var A={theme:{backdropFilter:{none:"none","blur-1":"blur(0.25rem)","blur-2":"blur(0.5rem)","blur-3":"blur(0.75rem)","blur-4":"blur(1rem)","blur-5":"blur(1.25rem)","blur-6":"blur(1.5rem)"},truncate:{lines:{2:"2",3:"3",4:"4",5:"5"}},extend:{backgroundOpacity:{95:.95},borderRadius:{inherit:"inherit"},boxShadow:{menu:"inset 0 0 0 1px rgba(0, 0, 0, 0.1), 0 1px 5px rgba(0, 0, 0, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.1)"},fontSize:{"code-inline":"0.9375em"},fontFamily:{inherit:"inherit"},lineHeight:{inherit:"inherit"},minWidth:{"max-content":"max-content"}}},plugins:[require("@tailwindcss/ui"),require("tailwindcss-filters"),require("tailwindcss-truncate-multiline")()]},S=["letter-spacing"],E=a({stylisPlugins:function(r,e,t){var n=t[0];switch(r){case 1:return e+" !important";case 3:return"@font-face"===n||n.startsWith("@")&&n.includes("keyframes")?j(e," !important",""):e;default:return e}},prefix:function(r){return!S.includes(r)}}),M={color:{primary:{base:"#667eea".toString(),text:"#fff".toString(),active:"#5a67d8".toString()}}};exports.ThemeProvider=function(r){var t=r.theme,i=r.importantStyles,o=void 0!==i&&i,a=r.children;return e.createElement(u.ThemeProvider,{theme:g(M,void 0===t?M:t)},o?e.createElement(n.CacheProvider,{value:E},a):a)},exports.__DEV__=!1,exports.assignRef=O,exports.clamp=function(r,e,t){return void 0===r&&(r=0),void 0===e&&(e=0),void 0===t&&(t=255),Math.min(Math.max(r,e),t)},exports.cleanChildren=function(r){return e.Children.toArray(r).filter((function(r){return e.isValidElement(r)}))},exports.closest=function(r,e){var t=e.reduce((function(e,t){return Math.abs(t-r)<Math.abs(e-r)?t:e}));return[e.indexOf(t),t]},exports.createContext=function(r){void 0===r&&(r={});var t=r.strict,n=void 0===t||t,i=r.errorMessage,o=void 0===i?"useContext must be inside a Provider with a value":i,u=r.name,a=e.createContext(void 0);return a.displayName=u,[a.Provider,function(){var r=e.useContext(a);if(!r&&n)throw new Error(o);return r},a]},exports.decodeHTML=function(r){if(void 0===r&&(r=""),h())return r;var e=document.createElement("textarea");return e.innerHTML=r,e.value},exports.filterObject=function(r,e,t){return void 0===t&&(t=!1),Object.keys(r).filter((function(r){return t?!e.includes(r):e.includes(r)})).reduce((function(e,t){var n;return Object.assign(e,((n={})[t]=r[t],n))}),{})},exports.filterProps=function(r){return s(r)?{}:Object.entries(r).reduce((function(r,e){var t,n=e[0],o=e[1];return i(n)?x({},r,((t={})[n]=o,t)):r}),{})},exports.formatNumber=b,exports.formatPrice=function(r,e){var t=r,n=function(t){var n=Number(t);return f(n)?b(n,x({style:"currency"},e)):r.toString()};if(!Array.isArray(t))return n(t);var i=t.map(Number),o=Math.min.apply(Math,i),u=Math.max.apply(Math,i);return o===u?n(o):n(o)+"–"+n(u)},exports.forwardRefWithAs=function(r){return t.forwardRef(r)},exports.getDecimalPlaces=y,exports.getStylesObject=function(r,e){return e?{}:r},exports.inferStylesObjectKeys=function(r){return r},exports.isArray=l,exports.isBoolean=function(r){return"boolean"==typeof r},exports.isEmpty=v,exports.isEmptyArray=d,exports.isEmptyObject=m,exports.isFunction=function(r){return"function"==typeof r},exports.isNullOrUndefined=s,exports.isNumber=f,exports.isObject=p,exports.isSSR=h,exports.isString=c,exports.isValidURL=function(r,e){return void 0===e&&(e=!1),!(!r||v(r)||(!e||!r.startsWith("/"))&&null===function(r){void 0===r&&(r="");var e=r;/^https?:\/\/*/.test(r)||(e="http://"+r);try{return new URL(e)}catch(r){return null}}(r))},exports.mapStyles=function(r){return Object.entries(r).reduce((function(r,e){var t;return Object.assign(r,((t={})[e[0]]=n.css(e[1]),t))}),{})},exports.merge=g,exports.mergeRefs=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return function(r){e.forEach((function(e){return e&&O(e,r)}))}},exports.noop=function(){},exports.pluralize=function(r,e,t){return 1===r?e:t},exports.replaceAll=j,exports.round=function(r,e){if(e<1){var t=y(e);return parseFloat(r.toFixed(t))}return Math.round(r/e)*e},exports.setRef=w,exports.styled=o,exports.tailwindConfig=A,exports.useDebounce=function(r,t,n){void 0===t&&(t=50),void 0===n&&(n={isImmediate:!1});var i=e.useRef();return function(){for(var e=this,o=arguments.length,u=new Array(o),a=0;a<o;a++)u[a]=arguments[a];i.current&&clearTimeout(i.current);var s=function(){i.current=void 0,n.isImmediate||r.apply(e,u)},c=n.isImmediate&&void 0===i.current;i.current=setTimeout(s,t),c&&r.apply(this,u)}},exports.useTheme=function(){return u.useTheme()}; | ||
"use strict";function r(r){return r&&"object"==typeof r&&"default"in r?r.default:r}var e=require("react"),t=r(e),n=require("@emotion/core"),i=r(require("@emotion/is-prop-valid")),o=r(require("@emotion/styled")),u=require("emotion-theming"),a=r(require("@emotion/cache"));function c(){return(c=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r}).apply(this,arguments)}function s(r){return null==r}function f(r){return"string"==typeof r}function l(r){return"number"==typeof r&&!Number.isNaN(r)}function p(r){return Array.isArray(r)}var d=function(r){var e=typeof r;return null!==r&&("object"===e||"function"===e)&&!p(r)},m=function(r){return p(r)&&0===r.length},v=function(r){return d(r)&&0===Object.keys(r).length},x=function(r){return!!s(r)||(p(r)?m(r):d(r)?v(r):!!f(r)&&""===r.trim())};function h(){return"undefined"==typeof window}function y(r){var e=/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/.exec(r.toString());return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0}function b(r,e){var t=e.neutral,n=void 0===t||t,i=e.language,o=void 0===i?h()?"en-US":navigator.language:i,u=function(r,e){if(null==r)return{};var t,n,i={},o=Object.keys(r);for(n=0;n<o.length;n++)e.indexOf(t=o[n])>=0||(i[t]=r[t]);return i}(e,["neutral","language"]);return l(r)?new Intl.NumberFormat(n?o.split("-")[0]:o,u).format(r):r}function g(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];if(!d(r)||!t.length)return r;var i=t.shift();return i&&d(i)?(Object.keys(i).forEach((function(e){var t=r[e],n=i[e];r[e]=Array.isArray(t)&&Array.isArray(n)?t.concat(n):d(t)&&d(n)?g(c({},t),n):n})),r):r}function w(r,e){void 0===r&&(r=null),r&&("function"==typeof r?r(e):r.current=e)}function O(r,e){if(null!=r)try{w(r,e)}catch(r){throw new Error("Cannot assign value to ref")}}function j(r,e,t){return f(e)?r.split(e).join(t):Object.entries(e).reduce((function(r,e){return j(r,e[0],e[1])}),r)}var A={theme:{backdropFilter:{none:"none","blur-1":"blur(0.25rem)","blur-2":"blur(0.5rem)","blur-3":"blur(0.75rem)","blur-4":"blur(1rem)","blur-5":"blur(1.25rem)","blur-6":"blur(1.5rem)"},truncate:{lines:{2:"2",3:"3",4:"4",5:"5"}},extend:{backgroundOpacity:{95:.95},borderRadius:{inherit:"inherit"},boxShadow:{menu:"inset 0 0 0 1px rgba(0, 0, 0, 0.1), 0 1px 5px rgba(0, 0, 0, 0.1), inset 0 -1px 0 rgba(0, 0, 0, 0.1)"},fontSize:{"code-inline":"0.9375em"},fontFamily:{inherit:"inherit"},lineHeight:{inherit:"inherit"},minWidth:{"max-content":"max-content"}}},plugins:[require("@tailwindcss/ui"),require("tailwindcss-filters"),require("tailwindcss-truncate-multiline")()]},S=["letter-spacing"],E=a({stylisPlugins:function(r,e,t){var n=t[0];switch(r){case 1:return e+" !important";case 3:return"@font-face"===n||n.startsWith("@")&&n.includes("keyframes")?j(e," !important",""):e;default:return e}},prefix:function(r){return!S.includes(r)}}),M={color:{primary:{base:"#667eea".toString(),text:"#fff".toString(),active:"#5a67d8".toString()}}};exports.ThemeProvider=function(r){var t=r.theme,i=r.importantStyles,o=void 0!==i&&i,a=r.children;return e.createElement(u.ThemeProvider,{theme:g(M,void 0===t?M:t)},o?e.createElement(n.CacheProvider,{value:E},a):a)},exports.__DEV__=!1,exports.assignRef=O,exports.clamp=function(r,e,t){return void 0===r&&(r=0),void 0===e&&(e=0),void 0===t&&(t=255),Math.min(Math.max(r,e),t)},exports.cleanChildren=function(r){return e.Children.toArray(r).filter((function(r){return e.isValidElement(r)}))},exports.closest=function(r,e){var t=e.reduce((function(e,t){return Math.abs(t-r)<Math.abs(e-r)?t:e}));return[e.indexOf(t),t]},exports.createContext=function(r){void 0===r&&(r={});var t=r.strict,n=void 0===t||t,i=r.errorMessage,o=void 0===i?"useContext must be inside a Provider with a value":i,u=r.name,a=e.createContext(void 0);return a.displayName=u,[a.Provider,function(){var r=e.useContext(a);if(!r&&n)throw new Error(o);return r},a]},exports.decodeHTML=function(r){if(void 0===r&&(r=""),h())return r;var e=document.createElement("textarea");return e.innerHTML=r,e.value},exports.filterObject=function(r,e,t){return void 0===t&&(t=!1),Object.keys(r).filter((function(r){return t?!e.includes(r):e.includes(r)})).reduce((function(e,t){var n;return Object.assign(e,((n={})[t]=r[t],n))}),{})},exports.filterProps=function(r){return s(r)?{}:Object.entries(r).reduce((function(r,e){var t,n=e[0],o=e[1];return i(n)?c({},r,((t={})[n]=o,t)):r}),{})},exports.formatNumber=b,exports.formatPrice=function(r,e){var t=r,n=function(t){var n=Number(t);return l(n)?b(n,c({style:"currency"},e)):r.toString()};if(!Array.isArray(t))return n(t);var i=t.map(Number),o=Math.min.apply(Math,i),u=Math.max.apply(Math,i);return o===u?n(o):n(o)+"–"+n(u)},exports.forwardRefWithAs=function(r){return t.forwardRef(r)},exports.getDecimalPlaces=y,exports.getStylesObject=function(r,e){return e?{}:r},exports.groupBy=function(r,e){return r.reduce((function(r,t){var n;return c({},r,((n={})[t[e]]=(r[t[e]]||[]).concat(t),n))}),{})},exports.inferStylesObjectKeys=function(r){return r},exports.isArray=p,exports.isBoolean=function(r){return"boolean"==typeof r},exports.isEmpty=x,exports.isEmptyArray=m,exports.isEmptyObject=v,exports.isFunction=function(r){return"function"==typeof r},exports.isNullOrUndefined=s,exports.isNumber=l,exports.isObject=d,exports.isSSR=h,exports.isString=f,exports.isValidURL=function(r,e){return void 0===e&&(e=!1),!(!r||x(r)||(!e||!r.startsWith("/"))&&null===function(r){void 0===r&&(r="");var e=r;/^https?:\/\/*/.test(r)||(e="http://"+r);try{return new URL(e)}catch(r){return null}}(r))},exports.mapStyles=function(r){return Object.entries(r).reduce((function(r,e){var t;return Object.assign(r,((t={})[e[0]]=n.css(e[1]),t))}),{})},exports.merge=g,exports.mergeRefs=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return function(r){e.forEach((function(e){return e&&O(e,r)}))}},exports.noop=function(){},exports.pluralize=function(r,e,t){return 1===r?e:t},exports.replaceAll=j,exports.round=function(r,e){if(e<1){var t=y(e);return parseFloat(r.toFixed(t))}return Math.round(r/e)*e},exports.setRef=w,exports.styled=o,exports.tailwindConfig=A,exports.useDebounce=function(r,t,n){void 0===t&&(t=50),void 0===n&&(n={isImmediate:!1});var i=e.useRef();return function(){for(var e=this,o=arguments.length,u=new Array(o),a=0;a<o;a++)u[a]=arguments[a];i.current&&clearTimeout(i.current);var c=function(){i.current=void 0,n.isImmediate||r.apply(e,u)},s=n.isImmediate&&void 0===i.current;i.current=setTimeout(c,t),s&&r.apply(this,u)}},exports.useTheme=function(){return u.useTheme()}; | ||
//# sourceMappingURL=react-sdk-utils.cjs.production.min.js.map |
@@ -0,3 +1,3 @@ | ||
import { extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
import { isNullOrUndefined } from '../assertion.esm.js'; | ||
import { extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
import { css } from '@emotion/core'; | ||
@@ -4,0 +4,0 @@ import isPropValid from '@emotion/is-prop-valid'; |
{ | ||
"name": "@sajari/react-sdk-utils", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Shared utils for the Sajari React packages.", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
143006
61
1167