From 4ce177eadd5596503c1c647fd84d1b5d654de6d8 Mon Sep 17 00:00:00 2001 From: mwcz Date: Thu, 14 Mar 2013 14:38:03 -0300 Subject: [PATCH 1/3] add semicolon to self-defining function (sdf) --- snippets/javascript.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index 9a98add..141f933 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -129,7 +129,7 @@ snippet sdf $1 = function ($2) { ${4:// main code} }; - } + }; # singleton snippet sing function ${1:Singleton} (${2:argument}) { From c85575e50d366f41d130c740159dd737f35f5a49 Mon Sep 17 00:00:00 2001 From: mwcz Date: Thu, 14 Mar 2013 15:13:36 -0300 Subject: [PATCH 2/3] 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(); + } From 91f24bd88b9aaf040eeea78024e1e2d786219a2b Mon Sep 17 00:00:00 2001 From: mwcz Date: Fri, 15 Mar 2013 14:53:35 -0300 Subject: [PATCH 3/3] fix javascript `object` function snippet --- snippets/javascript.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index cf543e8..2901587 100644 --- a/snippets/javascript.snippets +++ b/snippets/javascript.snippets @@ -156,7 +156,7 @@ snippet sing } # Crockford's object function snippet obj - object(o) { + function object(o) { function F() {} F.prototype = o; return new F();