<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr - davidwaterston</title>
<link>http://snipplr.com/users/davidwaterston/tags/function</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Thu, 23 May 2013 04:23:51 GMT</pubDate>
<item>
<title>(JavaScript) Template for a Javascript function with optional and mandatory arguments passed as an object collection</title>
<link>http://snipplr.com/view/68920/template-for-a-javascript-function-with-optional-and-mandatory-arguments-passed-as-an-object-collection/</link>
<description><![CDATA[ <p>A simple template for a JavaScript function which allows for an arbitrary number of named arguments to be passed in. This is achieved by passing a single object as an argument with each of the 'real' arguments being a key/value pair. In this way arguments can be passed in any order and we can easily add in new arguments.

To call, simply pass in an object with the required arguments:
    myFunction ({opt1: 'cat', opt4: 'dog', opt2: 'monkey'})

Validates clean in jsLint.</p> ]]></description>
<pubDate>Mon, 03 Dec 2012 07:48:27 GMT</pubDate>
<guid>http://snipplr.com/view/68920/template-for-a-javascript-function-with-optional-and-mandatory-arguments-passed-as-an-object-collection/</guid>
</item>
</channel>
</rss>