Permalink
Browse files

[node] test for 0.4.0

  • Loading branch information...
1 parent 0696d5d commit 692ead437c00f133e3d4203042d605de6cf272ac @edwardhotchkiss committed Apr 29, 2012
Showing with 10 additions and 11 deletions.
  1. +1 −0 .travis.yml
  2. +8 −10 lib/short.js
  3. +1 −1 package.json
View
@@ -1,5 +1,6 @@
language: node_js
node_js:
+ - 0.4
- 0.6
branches:
View
@@ -69,21 +69,19 @@ function createModel() {
*/
var generate = exports.generate = function(URL, options, callback) {
- var hashedURL,
- customData;
+ var hashedURL
+ , customData;
// options takes an optional object literal
// right now it only supports an options.length argument
if (arguments.length === 2 && arguments[1] instanceof Function) {
callback = arguments[1];
hashedURL = hasher(URL);
- }
- else if (arguments.length === 3 && arguments[1] instanceof Object && arguments[2] instanceof Function) {
+ } else if (arguments.length === 3 && arguments[1] instanceof Object && arguments[2] instanceof Function) {
hashedURL = (options.length) ? hasher(URL, options.length) : hasher(URL);
customData = (options.data) ? options.data : null;
- }
- else {
+ } else {
throw new Error("generate requires a URL and callback function!");
- }
+ };
var item = new ShortURL({
URL : URL,
hash : hashedURL
@@ -97,7 +95,7 @@ var generate = exports.generate = function(URL, options, callback) {
generate(URL, options, callback);
} else {
generate(URL, callback);
- }
+ };
} else {
callback(null, item);
}
@@ -118,8 +116,8 @@ var retrieve = exports.retrieve = function(hash, options, callback) {
// options takes an optional object literal
// right now it only supports an options.visitor argument
} else {
- throw new Error("retrieve requires a hash and callback function!");
- }
+ throw new Error('retrieve requires a hash and callback function!');
+ };
ShortURL.findByHash(hash, options, function(error, shortenedURLObject) {
if (error) {
callback(error, null);
View
@@ -17,7 +17,7 @@
"keywords":["short","url","shortener","tiny","uri","vanity","bit.ly"],
"main":"./lib/short",
"engines":{
- "node":">= 0.6.15 < 0.7.0"
+ "node":">= 0.4.0 < 0.7.0"
},
"dependencies":{
"mongoose":"2.5.13"

0 comments on commit 692ead4

Please sign in to comment.