{"ScriptPreparationCode":"// empty array\r\nwindow.foo1 = [];\r\n\r\n// array of strings\r\nwindow.foo2 = [\u0027a\u0027, \u0027b\u0027, \u0027c\u0027, \u0027d\u0027, \u0027e\u0027];\r\n\r\n// array of objects\r\nwindow.foo3 = [{ a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }, { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }, { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }];\r\n\r\n// empty string\r\nwindow.foo4 = \u0027\u0027;\r\n\r\n// filled string\r\nwindow.foo5 = \u0027Comparing performance of: isEmpty empty strings vs length empty strings isEmpty filled string vs length filled string\u0027;\r\n\r\nfunction isEmpty(value){\r\n return value === undefined ||\r\n value === null ||\r\n (typeof value === \u0022object\u0022 \u0026\u0026 Object.keys(value).length === 0) ||\r\n (typeof value === \u0022string\u0022 \u0026\u0026 value.trim().length === 0)\r\n}","TestCases":[{"Name":"isEmpty empty array","Code":"_.isEmpty(window.foo1);","IsDeferred":false},{"Name":"length empty array","Code":"window.foo1.length === 0;","IsDeferred":false},{"Name":"custom isEmpty empty array","Code":"isEmpty(window.foo1);","IsDeferred":false},{"Name":"isEmpty array of strings","Code":"_.isEmpty(window.foo2);","IsDeferred":false},{"Name":"length array of strings","Code":"window.foo2.length === 0;","IsDeferred":false},{"Name":"custom isEmpty array of strings","Code":"isEmpty(window.foo2);","IsDeferred":false},{"Name":"isEmpty array of objects","Code":"_.isEmpty(window.foo3);","IsDeferred":false},{"Name":"length empty array of objects","Code":"window.foo3.length === 0;","IsDeferred":false},{"Name":"custom isEmpty array of objects","Code":"isEmpty(window.foo3);","IsDeferred":false},{"Name":"isEmpty empty string","Code":"_.isEmpty(window.foo4);","IsDeferred":false},{"Name":"length empty string","Code":"window.foo4.length === 0;","IsDeferred":false},{"Name":"custom isEmpty empty string ","Code":"isEmpty(window.foo4);","IsDeferred":false},{"Name":"isEmpty filled string","Code":"_.isEmpty(window.foo5);","IsDeferred":false},{"Name":"length filled string","Code":"window.foo5.length === 0;","IsDeferred":false},{"Name":"custom isEmpty filled string ","Code":"isEmpty(window.foo5);","IsDeferred":false}]}