mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 16:35:14 +00:00
1 line
4.7 KiB
JSON
1 line
4.7 KiB
JSON
{"ast":null,"code":"/**\n * Takes an argument and if it's an array, returns the first item in the array,\n * otherwise returns the argument. Used for Preact compatibility.\n */\nexport var unwrapArray = function unwrapArray(arg) {\n return Array.isArray(arg) ? arg[0] : arg;\n};\n/**\n * Takes a maybe-undefined function and arbitrary args and invokes the function\n * only if it is defined.\n */\n\nexport var safeInvoke = function safeInvoke(fn) {\n if (typeof fn === \"function\") {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return fn.apply(void 0, args);\n }\n};\n/**\n * Does a shallow equality check of two objects by comparing the reference\n * equality of each value.\n */\n\nexport var shallowEqual = function shallowEqual(objA, objB) {\n var aKeys = Object.keys(objA);\n var bKeys = Object.keys(objB);\n\n if (bKeys.length !== aKeys.length) {\n return false;\n }\n\n for (var i = 0; i < bKeys.length; i++) {\n var key = aKeys[i];\n\n if (objA[key] !== objB[key]) {\n return false;\n }\n }\n\n return true;\n};\n/**\n * Sets a ref using either a ref callback or a ref object\n */\n\nexport var setRef = function setRef(ref, node) {\n // if its a function call it\n if (typeof ref === \"function\") {\n return safeInvoke(ref, node);\n } // otherwise we should treat it as a ref object\n else if (ref != null) {\n ref.current = node;\n }\n};","map":{"version":3,"sources":["/app/node_modules/react-popper/lib/esm/utils.js"],"names":["unwrapArray","arg","Array","isArray","safeInvoke","fn","_len","arguments","length","args","_key","apply","shallowEqual","objA","objB","aKeys","Object","keys","bKeys","i","key","setRef","ref","node","current"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAO,IAAIA,WAAW,GAAG,SAASA,WAAT,CAAqBC,GAArB,EAA0B;AACjD,SAAOC,KAAK,CAACC,OAAN,CAAcF,GAAd,IAAqBA,GAAG,CAAC,CAAD,CAAxB,GAA8BA,GAArC;AACD,CAFM;AAGP;A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AgBC,GAAhB,EAAqBC,IAArB,EAA2B;AAC7C;AACA,MAAI,OAAOD,GAAP,KAAe,UAAnB,EAA+B;AAC7B,WAAOlB,UAAU,CAACkB,GAAD,EAAMC,IAAN,CAAjB;AACD,GAFD,CAEE;AAFF,OAGK,IAAID,GAAG,IAAI,IAAX,EAAiB;AAClBA,IAAAA,GAAG,CAACE,OAAJ,GAAcD,IAAd;AACD;AACJ,CARM","sourcesContent":["/**\n * Takes an argument and if it's an array, returns the first item in the array,\n * otherwise returns the argument. Used for Preact compatibility.\n */\nexport var unwrapArray = function unwrapArray(arg) {\n return Array.isArray(arg) ? arg[0] : arg;\n};\n/**\n * Takes a maybe-undefined function and arbitrary args and invokes the function\n * only if it is defined.\n */\n\nexport var safeInvoke = function safeInvoke(fn) {\n if (typeof fn === \"function\") {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n return fn.apply(void 0, args);\n }\n};\n/**\n * Does a shallow equality check of two objects by comparing the reference\n * equality of each value.\n */\n\nexport var shallowEqual = function shallowEqual(objA, objB) {\n var aKeys = Object.keys(objA);\n var bKeys = Object.keys(objB);\n\n if (bKeys.length !== aKeys.length) {\n return false;\n }\n\n for (var i = 0; i < bKeys.length; i++) {\n var key = aKeys[i];\n\n if (objA[key] !== objB[key]) {\n return false;\n }\n }\n\n return true;\n};\n/**\n * Sets a ref using either a ref callback or a ref object\n */\n\nexport var setRef = function setRef(ref, node) {\n // if its a function call it\n if (typeof ref === \"function\") {\n return safeInvoke(ref, node);\n } // otherwise we should treat it as a ref object\n else if (ref != null) {\n ref.current = node;\n }\n};"]},"metadata":{},"sourceType":"module"} |