{"ScriptPreparationCode":"var person = {name: \u0027Frederick\u0027, lastName: \u0027Corcino Alejo\u0027, nested: {name: \u0027test\u0027}};\r\n\r\nfunction justGet(obj, propsArg, defaultValue) {\r\n if (!obj) {\r\n return defaultValue;\r\n }\r\n var props, prop;\r\n if (Array.isArray(propsArg)) {\r\n props = propsArg.slice(0);\r\n }\r\n if (typeof propsArg == \u0027string\u0027) {\r\n props = propsArg.split(\u0027.\u0027);\r\n }\r\n if (typeof propsArg == \u0027symbol\u0027) {\r\n props = [propsArg];\r\n }\r\n if (!Array.isArray(props)) {\r\n throw new Error(\u0027props arg must be an array, a string or a symbol\u0027);\r\n }\r\n while (props.length) {\r\n prop = props.shift();\r\n if (!obj) {\r\n return defaultValue;\r\n }\r\n obj = obj[prop];\r\n if (obj === undefined) {\r\n return defaultValue;\r\n }\r\n }\r\n return obj;\r\n}\r\n\r\nfunction justSet(obj, propsArg, value) {\r\n var props, lastProp;\r\n if (Array.isArray(propsArg)) {\r\n props = propsArg.slice(0);\r\n }\r\n if (typeof propsArg == \u0027string\u0027) {\r\n props = propsArg.split(\u0027.\u0027);\r\n }\r\n if (typeof propsArg == \u0027symbol\u0027) {\r\n props = [propsArg];\r\n }\r\n if (!Array.isArray(props)) {\r\n throw new Error(\u0027props arg must be an array, a string or a symbol\u0027);\r\n }\r\n lastProp = props.pop();\r\n if (!lastProp) {\r\n return false;\r\n }\r\n prototypeCheck(lastProp);\r\n var thisProp;\r\n while ((thisProp = props.shift())) {\r\n prototypeCheck(thisProp);\r\n if (typeof obj[thisProp] == \u0027undefined\u0027) {\r\n obj[thisProp] = {};\r\n }\r\n obj = obj[thisProp];\r\n if (!obj || typeof obj != \u0027object\u0027) {\r\n return false;\r\n }\r\n }\r\n obj[lastProp] = value;\r\n return true;\r\n}\r\n\r\nfunction prototypeCheck(prop) {\r\n // coercion is intentional to catch prop values like \u0060[\u0027__proto__\u0027]\u0060\r\n if (prop == \u0027__proto__\u0027 || prop == \u0027constructor\u0027 || prop == \u0027prototype\u0027) {\r\n throw new Error(\u0027setting of prototype values not supported\u0027);\r\n }\r\n}","TestCases":[{"Name":"Lodash get","Code":"_.get(person, \u0027name\u0027, \u0027\u0027);\r\n_.get(person, \u0027nested.name\u0027, \u0027\u0027);","IsDeferred":false},{"Name":"Just get","Code":"justGet(person, \u0027name\u0027, \u0027\u0027);\r\njustGet(person, \u0027nested.name\u0027, \u0027\u0027);","IsDeferred":false},{"Name":"Lodash set","Code":"_.set(person, \u0027nested.name.test\u0027, \u0027test\u0027);\r\n_.set(person, \u0027name\u0027, \u0027test\u0027);\r\n_.set(person, \u0027nested.name\u0027, \u0027test\u0027);","IsDeferred":false},{"Name":"Just set","Code":"justSet(person, \u0027nested.name.test\u0027, \u0027test\u0027);\r\njustSet(person, \u0027name\u0027, \u0027test\u0027);\r\njustSet(person, \u0027nested.name\u0027, \u0027test\u0027);","IsDeferred":false}]}