Comparing version 0.2.0 to 0.2.1
11
index.js
@@ -18,3 +18,5 @@ /* | ||
}; | ||
return range; | ||
// Return an error if no range is made. | ||
// This should NOT happen, but error if it does! | ||
return (!!(range.length)?range:RangeGen.handleError(RangeGen.Errors("NotGenerated"),error)); | ||
}; | ||
@@ -42,4 +44,4 @@ RangeGen.validate = function (to, from) { | ||
RangeGen.enc = function (num,lcase) { | ||
if (lcase==null) { | ||
return num; | ||
if (lcase == null) { | ||
return Number(num); | ||
}; | ||
@@ -93,3 +95,3 @@ var str = ""; | ||
hasNext: function () { | ||
return (this.loops>0?true:false); | ||
return !!(this.loops>0); | ||
}, | ||
@@ -121,2 +123,3 @@ next: function () { | ||
var Errors = { | ||
"NotGenerated": {name:"NotGenerated",message:"Failed to generate a valid range!"}, | ||
"InvalidInput": {name:"InvalidInput",message:"\"from\" and \"to\" must be letters or numbers only!"}, | ||
@@ -123,0 +126,0 @@ "InvalidFrom": {name:"InvalidFrom",message:"\"from\" must be a letter!"}, |
{ | ||
"name": "rangegen", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/LouisT/RangeGen", | ||
"version": "0.2.1", | ||
"homepage": "https://louist.github.io/RangeGen/", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Louis T.", |
@@ -1,2 +0,2 @@ | ||
RangeGen (v0.2.0) | ||
RangeGen (v0.2.1) | ||
====== | ||
@@ -13,2 +13,3 @@ | ||
Generate a range between two numbers or letters. Examples: 1-100, a-z, A-Z, a-zz or even A-ZZZZZ. | ||
Example: [http://louist.github.io/RangeGen/example.html](http://louist.github.io/RangeGen/example.html "Title") | ||
@@ -135,22 +136,22 @@ Usage: | ||
<script> | ||
try { | ||
var a = RangeGen("a","z"); | ||
alert("[a-z] "+a.join(",")+"\n"); | ||
var b = RangeGen("z","a"); | ||
alert("[z-a] "+b.join(",")+"\n"); | ||
var c = RangeGen("A","ZZ",10); | ||
alert("[A-ZZ,10] "+c.join(",")+"\n"); | ||
var d = RangeGen("ZZ","A",10); | ||
alert("[ZZ-A,10] "+d.join(",")+"\n"); | ||
var e = RangeGen(0,100,10); | ||
alert("[0-100,10] "+e.join(",")+"\n"); | ||
var f = RangeGen(100,0,10); | ||
alert("[100-0,10] "+f.join(",")+"\n"); | ||
} catch (e) { | ||
alert(e); | ||
}; | ||
window.onload = function () { | ||
try { | ||
var a = RangeGen("a","z"); | ||
output("[a-z] "+a.join(",")+"\n"); | ||
var b = RangeGen("z","a"); | ||
output("[z-a] "+b.join(",")+"\n"); | ||
var c = RangeGen("A","ZZ",10); | ||
output("[A-ZZ,10] "+c.join(",")+"\n"); | ||
var d = RangeGen("ZZ","A",10); | ||
output("[ZZ-A,10] "+d.join(",")+"\n"); | ||
var e = RangeGen(0,100,10); | ||
output("[0-100,10] "+e.join(",")+"\n"); | ||
var f = RangeGen(100,0,10); | ||
output("[100-0,10] "+f.join(",")+"\n"); | ||
} catch (e) { | ||
output(e); | ||
}; | ||
try { | ||
var iterator = RangeGen.iter(-30,30,5,true); | ||
alert("Iterations: "+iterator.length); | ||
output("<br />Iterations: "+iterator.length); | ||
var range = []; | ||
@@ -160,14 +161,16 @@ while (iterator.hasNext()) { | ||
}; | ||
document.getElementById('iter').innerHTML = range.join(','); | ||
output(range.join(',')); | ||
} catch (e) { | ||
document.getElementById('iter').innerHTML = e; | ||
output(e); | ||
}; | ||
}; | ||
function output (x) { | ||
document.getElementById("output").innerHTML += x+"<br />"; | ||
}; | ||
</script> | ||
</head> | ||
<body> | ||
<div id="iter"> | ||
</div> | ||
<div id="output"></div> | ||
</body> | ||
</html> | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15778
220
174