From 1aa0f50942d526f497b1c6b3f5f584dc2b0d6c28 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Fri, 27 Nov 2015 18:15:24 -0500 Subject: [PATCH] Use ES7 spread properties to make shallow clones of objects. I don't know if you have ES7 object rest/spread properties enabled, but, if you do, here's an easy ES7 idiom for creating a new object with all the same own properties of a given object. Specification: https://github.com/sebmarkbage/ecmascript-rest-spread --- style/javascript.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/style/javascript.md b/style/javascript.md index 0f80d0c..c0488b7 100644 --- a/style/javascript.md +++ b/style/javascript.md @@ -567,7 +567,7 @@ Method | Use... | ...instead of bind | `fn.bind(someObj, args)` | `_.bind(fn, someObj, args)` bind | `(a, b) => { ... }` [1](#u1) | `_.bind(function(a, b) { ... }, this)` bindAll | `obj.method = obj.method.bind(someObj);` [2](#u2) | `_.bindAll(someObj, "method")` -clone | No alternative at the moment! [3](#u3) | +clone | `{...obj}` | `_.clone(obj)` debounce | Our custom lodash build. | defer | `setTimeout(fn, 0);` | `_.defer(fn);` delay | `setTimeout(fn, 2000);` | `_.delay(fn, 2000);`