diff --git a/index.js b/index.js index a3d64b2..7b9ad51 100644 --- a/index.js +++ b/index.js @@ -23,6 +23,9 @@ function get(obj, path) { } function set(obj, path, value) { + if (path === undefined || path === null) { + return false; + } var keys = typeof path == 'string' ? parsePath(path) : Array.isArray(path) ? path : [path]; diff --git a/package.json b/package.json index 6c3a0f7..aaa59d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "deep-obj", - "version": "1.2.1", + "version": "1.2.2", "description": "Set and get values on objects via dot-notation strings", "main": "index.js", "scripts": {