Permalink
Browse files

Publish docs

  • Loading branch information...
1 parent d3fbb60 commit a8a8faf74d9113c16f5b892b3aa85daaa911f0a6 @c24w c24w committed Jan 22, 2016
View
@@ -0,0 +1,214 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <title>actionhelper.js</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <link rel="stylesheet" media="all" href="public/stylesheets/normalize.css" />
+ <link rel="stylesheet" media="all" href="docco.css" />
+</head>
+<body>
+ <div class="container">
+ <div class="page">
+
+ <div class="header">
+
+ <h1>actionhelper.js</h1>
+
+
+
+ <div class="toc">
+ <h3>Table of Contents</h3>
+ <ol>
+
+
+ <li>
+ <a class="source" href="customconfig.html">
+ customconfig.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="default-action.html">
+ default-action.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="oauth.html">
+ oauth.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="simpleclient.html">
+ simpleclient.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="two-legged.html">
+ two-legged.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="user-authentication.html">
+ user-authentication.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="user-locker.html">
+ user-locker.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="user-management.html">
+ user-management.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="actionhelper.html">
+ actionhelper.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="api.html">
+ api.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="cache.html">
+ cache.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="cleaners.html">
+ cleaners.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="errors.html">
+ errors.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="helpers.html">
+ helpers.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="logger.html">
+ logger.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="noop-cache.html">
+ noop-cache.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="oauth.html">
+ oauth.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="request.html">
+ request.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="resource.html">
+ resource.js
+ </a>
+ </li>
+
+
+ <li>
+ <a class="source" href="responseparser.html">
+ responseparser.js
+ </a>
+ </li>
+
+ </ol>
+ </div>
+
+ </div>
+
+
+
+
+
+ <div class='highlight'><pre><span class="hljs-pi">'use strict'</span>;
+
+<span class="hljs-keyword">var</span> _ = <span class="hljs-built_in">require</span>(<span class="hljs-string">'lodash'</span>);
+
+<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">templateParams</span><span class="hljs-params">(url)</span> </span>{
+ <span class="hljs-keyword">return</span> url.match(<span class="hljs-regexp">/:([^/]+)/g</span>);
+}
+
+<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">template</span><span class="hljs-params">(url, params)</span> </span>{
+ <span class="hljs-keyword">var</span> templated = url;
+ <span class="hljs-keyword">var</span> keys = _.keys(params);
+ <span class="hljs-keyword">var</span> loweredKeys = _.map(keys, <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-params">(key)</span> </span>{
+ <span class="hljs-keyword">return</span> key.toLowerCase();
+ });
+ <span class="hljs-keyword">var</span> keyLookup = _.zipObject(loweredKeys, keys);
+
+ _.each(templateParams(url), <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">replaceParam</span><span class="hljs-params">(param)</span> </span>{
+ <span class="hljs-keyword">var</span> normalisedParam = param.toLowerCase().substr(<span class="hljs-number">1</span>);
+
+ <span class="hljs-keyword">if</span> (!keyLookup[normalisedParam]) {
+ <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">'Missing '</span> + normalisedParam);
+ }
+
+ templated = templated.replace(param,
+ params[keyLookup[normalisedParam]]);
+ <span class="hljs-keyword">delete</span> params[keyLookup[normalisedParam]];
+ });
+
+ <span class="hljs-keyword">return</span> templated;
+}
+
+<span class="hljs-built_in">module</span>.exports = exports = {
+ templateParams: templateParams,
+ template: template
+};</pre></div>
+
+
+ <div class="fleur">h</div>
+ </div>
+ </div>
+</body>
+</html>
Oops, something went wrong.

0 comments on commit a8a8faf

Please sign in to comment.