{"ScriptPreparationCode":"function _isString(x) {\r\n return Object.prototype.toString.call(x) === \u0027[object String]\u0027;\r\n}\r\n\r\nfunction _isPlaceholder(a) {\r\n return a != null \u0026\u0026\r\n typeof a === \u0027object\u0027 \u0026\u0026\r\n a[\u0027@@functional/placeholder\u0027] === true;\r\n}\r\n\r\nfunction _curry1(fn) {\r\n return function f1(a) {\r\n if (arguments.length === 0 || _isPlaceholder(a)) {\r\n return f1;\r\n } else {\r\n return fn.apply(this, arguments);\r\n }\r\n };\r\n}\r\nvar _isArrayLike = _curry1(function isArrayLike(x) {\r\n if (Array.isArray(x)) {\r\n return true;\r\n }\r\n if (!x) {\r\n return false;\r\n }\r\n if (typeof x !== \u0027object\u0027) {\r\n return false;\r\n }\r\n if (_isString(x)) {\r\n return false;\r\n }\r\n if (x.length === 0) {\r\n return true;\r\n }\r\n if (x.length \u003E 0) {\r\n return x.hasOwnProperty(0) \u0026\u0026 x.hasOwnProperty(x.length - 1);\r\n }\r\n return false;\r\n});\r\n\r\n\r\nfunction _makeFlat(recursive) {\r\n return function flatt(list) {\r\n var value, jlen, j;\r\n var result = [];\r\n var idx = 0;\r\n var ilen = list.length;\r\n\r\n while (idx \u003C ilen) {\r\n if (_isArrayLike(list[idx])) {\r\n value = recursive ? flatt(list[idx]) : list[idx];\r\n j = 0;\r\n jlen = value.length;\r\n while (j \u003C jlen) {\r\n result[result.length] = value[j];\r\n j \u002B= 1;\r\n }\r\n } else {\r\n result[result.length] = list[idx];\r\n }\r\n idx \u002B= 1;\r\n }\r\n return result;\r\n }\r\n };\r\n\r\n\r\n var flatten = _curry1(_makeFlat(true));","TestCases":[{"Name":"Ramda Flatten Function","Code":"var params = [1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12], [1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11, [1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]], 12]]]]]]];\r\nvar other = flatten([1, 2, params]);","IsDeferred":false},{"Name":"Array.prototype.flat","Code":"var params = [1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12], [1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11, [1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]], 12]]]]]]];\r\nvar other = [1, 2, params].flat(Infinity)","IsDeferred":false}]}