diff --git a/index.js b/index.js index e69de29bb..8b4def432 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,21 @@ +function updateObjectWithKeyAndValue(object, key, value) { + const newObj = Object.assign({}, object); + newObj[key] = value; + return newObj; +} + +function destructivelyUpdateObjectWithKeyAndValue(object, key, value) { + object[key] = value; + return object; +} + +function deleteFromObjectByKey(object, key) { + const newObj = Object.assign({}, object); + delete newObj[key]; + return newObj; +} + +function destructivelyDeleteFromObjectByKey(object, key) { + delete object[key]; + return object; +}