diff --git a/snippets/javascript.snippets b/snippets/javascript.snippets index 9a98add..2901587 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}) { @@ -154,3 +154,10 @@ snippet sing return instance; } +# Crockford's object function +snippet obj + function object(o) { + function F() {} + F.prototype = o; + return new F(); + }