From ad2f92af54fab16e5a5fd0cc0e522eca4824c77a Mon Sep 17 00:00:00 2001 From: Juho Vepsalainen Date: Tue, 27 Aug 2019 17:51:06 +0200 Subject: [PATCH] docs(readme): Add a note about precedence Closes #115. --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 29f95ef..84e796c 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,15 @@ var output = merge(object1, object2, object3, ...); // You can pass an array of objects directly. // This works with all available functions. var output = merge([object1, object2, object3]); + +// Please note that where keys match, +// the objects to the right take precedence: +var output = merge( + { fruit: "apple", color: "red" }, + { fruit: "strawberries" } +); +console.log(output); +// { color: "red", fruit: "strawberries"} ``` ### **`merge({ customizeArray, customizeObject })(...configuration | [...configuration])`**