Permalink
Browse files

remove globals, fixes from jshint

fixes #16
  • Loading branch information...
1 parent cdf6a3b commit 2f782ec362d4ba3fe723a40ce01c4ae7907e7e75 @seanmonstar seanmonstar committed Sep 21, 2012
Showing with 11 additions and 12 deletions.
  1. +11 −12 lib/connect-cachify.js
View
@@ -3,6 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/*jslint node: true, nomen: true, white: true*/
+"use strict";
var crypto = require('crypto'),
format = require('./compat').format,
@@ -14,8 +15,6 @@ var opts,
_assets,
_cache = {};
-"use strict";
-
exports.setup = function (assets, options) {
_assets = assets;
if (!options) options = {};
@@ -165,37 +164,37 @@ var prod_or_dev_tags = function (filename, link_fmt, hash) {
return format(link_fmt, hashify(filename, hash));
};
-exports.cachify_js = cachify_js = function (filename, options) {
+var cachify_js = exports.cachify_js = function (filename, options) {
if (! options) options = {};
return prod_or_dev_tags(filename,
'<script src="%s"></script>',
- options['hash']);
+ options.hash);
};
-exports.cachify_css = cachify_css = function (filename, options) {
+var cachify_css = exports.cachify_css = function (filename, options) {
if (! options) options = {};
return prod_or_dev_tags(filename,
'<link href="%s" rel="stylesheet" type="text/css">',
- options['hash']);
+ options.hash);
};
-exports.cachify = cachify = function (filename, options) {
+var cachify = exports.cachify = function (filename, options) {
var tag_format;
if (! options) options = {};
- if (options['tag_format'])
- tag_format = options['tag_format'];
+ if (options.tag_format)
+ tag_format = options.tag_format;
else
tag_format = '%s';
- return prod_or_dev_tags(filename, tag_format, options['hash']);
+ return prod_or_dev_tags(filename, tag_format, options.hash);
};
var no_url = function (prefix) {
if (prefix.indexOf('://') === -1) return prefix;
- var m = prefix.match(/^[a-z]{3,5}:\/\/[a-z0-9-_.]*(?:\:[0-9]*)?\/(.*)$/i);
+ var m = prefix.match(/^[a-z]{3,5}:\/\/[a-z0-9\-_.]*(?:\:[0-9]*)?\/(.*)$/i);
if (m) return m[1];
else return prefix;
};
var escape_regex = function (str) {
return str.replace('/', '\/');
-};
+};

0 comments on commit 2f782ec

Please sign in to comment.