UNPKG

@gsretail.com/gui-core

Version:

A skeleton to create your own React component library using Rollup, TypeScript, Sass and Storybook

2 lines (1 loc) 1.4 kB
function t(t){return"string"==typeof t||t instanceof String}function r(t){return"object"==typeof t&&null!=t&&"Object"===t?.constructor?.name}function e(t,r){return Array.isArray(r)?e(t,((t,e)=>r.includes(e))):Object.entries(t).reduce(((t,e)=>{let[n,o]=e;return r(o,n)&&(t[n]=o),t}),{})}const n={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function o(t){switch(t){case n.LEFT:return n.FORCE_LEFT;case n.RIGHT:return n.FORCE_RIGHT;default:return t}}function i(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function f(t,r){if(r===t)return!0;const e=Array.isArray(r),n=Array.isArray(t);let o;if(e&&n){if(r.length!=t.length)return!1;for(o=0;o<r.length;o++)if(!f(r[o],t[o]))return!1;return!0}if(e!=n)return!1;if(r&&t&&"object"==typeof r&&"object"==typeof t){const e=r instanceof Date,n=t instanceof Date;if(e&&n)return r.getTime()==t.getTime();if(e!=n)return!1;const i=r instanceof RegExp,c=t instanceof RegExp;if(i&&c)return r.toString()==t.toString();if(i!=c)return!1;const u=Object.keys(r);for(o=0;o<u.length;o++)if(!Object.prototype.hasOwnProperty.call(t,u[o]))return!1;for(o=0;o<u.length;o++)if(!f(t[u[o]],r[u[o]]))return!1;return!0}return!(!r||!t||"function"!=typeof r||"function"!=typeof t)&&r.toString()===t.toString()}export{n as DIRECTION,i as escapeRegExp,o as forceDirection,r as isObject,t as isString,f as objectIncludes,e as pick};