From 66d70abc92d133b593c508e9ac454d0caeaf2bef Mon Sep 17 00:00:00 2001 From: David P Sanders Date: Sat, 27 Mar 2021 18:09:29 +0000 Subject: [PATCH] Done. --- index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/index.js b/index.js index e69de29bb..416bcd6b7 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,22 @@ +var recipies = {} + +function updateObjectWithKeyAndValue(object, key, value){ + return Object.assign({}, object, { [key]: value }) + +} + +function destructivelyUpdateObjectWithKeyAndValue(object,key,value){ + object[key] = value + return object +} + +function destructivelyDeleteFromObjectByKey(object, key){ + delete object[key] + return object +} + +function deleteFromObjectByKey(object, key){ + var newObj = Object.assign({}, object, [key] ) + delete newObj[key] + return newObj +}