{"ScriptPreparationCode":"var debounceR = R.curry((config, fn) =\u003E {\r\n const { delay, initialInstant = false } = (R.is(Number, config)\r\n ? { delay: config }\r\n : config);\r\n let timer = null;\r\n let firstCall = false;\r\n return (...args) =\u003E new Promise((resolve, reject) =\u003E {\r\n const safeCall = () =\u003E {\r\n try {\r\n resolve(fn.apply(window, args));\r\n }\r\n catch (e) {\r\n reject(e);\r\n }\r\n };\r\n if (!firstCall) {\r\n firstCall = true;\r\n if (initialInstant) {\r\n safeCall();\r\n return;\r\n }\r\n }\r\n if (!R.isNil(timer)) {\r\n clearTimeout(timer);\r\n }\r\n timer = setTimeout(safeCall, delay);\r\n });\r\n});\r\n\r\n\r\nvar debounceV = (func, timeout) =\u003E {\r\n let timer;\r\n return (...args) =\u003E {\r\n clearTimeout(timer);\r\n timer = setTimeout(() =\u003E { func.apply(this, args); }, timeout);\r\n };\r\n}\r\n\r\nvar handler = () =\u003E {};","TestCases":[{"Name":"ramda","Code":"debounceR({delay: 0}, handler)","IsDeferred":false},{"Name":"lodash","Code":"_.debounce(handler, 0)","IsDeferred":false}]}