Comparing version 0.1.0 to 0.1.1
20
index.js
exports = module.exports = function (chars, exports) { | ||
function inject (chars) { | ||
@@ -9,4 +9,6 @@ chars = chars || | ||
exports = exports || {} | ||
var exports = between | ||
exports.between = between | ||
exports.randstr = randstr | ||
@@ -19,2 +21,4 @@ exports.between = between | ||
exports.inject = inject | ||
function randstr(l) { | ||
@@ -78,3 +82,3 @@ var str = '' | ||
_a + 1 < _b | ||
? Math.round((_a+_b)/2) | ||
? Math.round((_a+_b)/2) | ||
: _a | ||
@@ -98,10 +102,8 @@ ] | ||
return exports | ||
} | ||
between.strord | ||
//so that the api I expected works... | ||
module.exports = function (a, b) { | ||
return module.exports.between(a, b) | ||
return between | ||
} | ||
exports(null, module.exports) | ||
module.exports = inject(null) |
@@ -1,16 +0,21 @@ | ||
{ "name": "between" | ||
, "version": "0.1.0" | ||
, "description": "generate arbitary strings that sort between two strings" | ||
, "homepage": "http://github.com/dominictarr/between" | ||
, "repository": | ||
{ "type": "git" | ||
, "url": "https://github.com/dominictarr/between.git" } | ||
, "dependencies": {} | ||
, "devDependencies": { | ||
"assertions" : "2", | ||
"asynct" : "1.1" | ||
} | ||
, "scripts": { | ||
"test" : "asynct test/index.js" | ||
} | ||
, "author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)" } | ||
{ | ||
"name": "between", | ||
"version": "0.1.1", | ||
"description": "generate arbitary strings that sort between two strings", | ||
"homepage": "http://github.com/dominictarr/between", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/dominictarr/between.git" | ||
}, | ||
"dependencies": { | ||
"tape": "~0.1.0" | ||
}, | ||
"devDependencies": { | ||
"assertions": "2", | ||
"asynct": "1.1" | ||
}, | ||
"scripts": { | ||
"test": "asynct test/index.js" | ||
}, | ||
"author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)" | ||
} |
@@ -0,5 +1,6 @@ | ||
var test = require('tape') | ||
var u = require('../') | ||
var a = require('assertions') | ||
function assertBetween (lo, hi, depth, between) { | ||
function assertBetween (_, lo, hi, depth, between) { | ||
between = between || u.between | ||
@@ -20,5 +21,5 @@ var b = between(lo, hi) | ||
if(~~(Math.random()*2)) | ||
assertBetween(lo, b, depth - 1, between) | ||
assertBetween(a, lo, b, depth - 1, between) | ||
else | ||
assertBetween(b, hi, depth - 1, between) | ||
assertBetween(a, b, hi, depth - 1, between) | ||
@@ -28,8 +29,8 @@ } | ||
exports.between = function (t) { | ||
test('between', function (t) { | ||
assertBetween('!', '~', 200) | ||
assertBetween(t, '!', '~', 200) | ||
t.end() | ||
} | ||
}) | ||
/* | ||
@@ -40,17 +41,17 @@ same as above but this time, append a random string to each. | ||
*/ | ||
exports.between2 = function (t) { | ||
test('between2', function (t) { | ||
assertBetween('!', '~', 200, function (a, b) { | ||
return between (a, b) + u.randstr(5) | ||
assertBetween(t, '!', '~', 200, function (a, b) { | ||
return u.between (a, b) + u.randstr(5) | ||
}) | ||
t.end() | ||
} | ||
}) | ||
exports.between3 = function (t) { | ||
test('between3', function (t) { | ||
assertBetween(u.lo, u.hi, 200, u('$&[{}(=*)+]!#~`').between) | ||
assertBetween(t, u.lo, u.hi, 200, u.inject('$&[{}(=*)+]!#~`')) | ||
t.end() | ||
} | ||
}) | ||
4720
1
+ Addedtape@~0.1.0
+ Addeddeep-equal@0.0.0(transitive)
+ Addeddefined@0.0.0(transitive)
+ Addedjsonify@0.0.1(transitive)
+ Addedtape@0.1.5(transitive)