From c85575e50d366f41d130c740159dd737f35f5a49 Mon Sep 17 00:00:00 2001 From: mwcz Date: Thu, 14 Mar 2013 15:13:36 -0300 Subject: [PATCH] add a snippet for Crockford's object() function --- snippets/javascript.snippets | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index 141f933..cf543e8 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -154,3 +154,10 @@ snippet sing return instance; } +# Crockford's object function +snippet obj + object(o) { + function F() {} + F.prototype = o; + return new F(); + }