fill-range
Advanced tools
Comparing version 1.0.0 to 1.1.0
28
index.js
@@ -27,3 +27,9 @@ /*! | ||
// store a ref to unmodified args | ||
var strA = a.toString(); | ||
var strB = b.toString(); | ||
var expand; | ||
b = (b.toString() === '-0') ? 0 : b; | ||
if (typeof step === 'string') { | ||
@@ -46,5 +52,2 @@ if (/\?/.test(step)) { | ||
// store a ref to the unmodified first arg | ||
var strA = a.toString(); | ||
// is the range alphabetical? or numeric? | ||
@@ -62,3 +65,3 @@ var isNumeric = isNumber(a); | ||
// detect padding | ||
var padding = isPadded(strA, isNumeric); | ||
var padding = isPadded(strA, strB); | ||
var res, pad, arr = []; | ||
@@ -92,8 +95,9 @@ var i = 0; | ||
function isPadded(strA, isNumeric) { | ||
return isNumeric && /^-*0+[1-9]/.test(strA) | ||
? function (a) { | ||
var num = strA.length - a.toString().length; | ||
return repeat('0', num); | ||
} : false; | ||
function isPadded(strA, strB) { | ||
if ((!/[^.]\./.test(strA) || !/[^.]\./.test(strB)) && /^-*0+[1-9]/.test(strA)) { | ||
return function (a) { | ||
return repeat('0', strA.length - a.toString().length); | ||
} | ||
} | ||
return false; | ||
} | ||
@@ -106,6 +110,6 @@ | ||
if (!isNumber(a) && isNumber(b)) { | ||
throw new TypeError('fill-range: incompatible range arguments.'); | ||
throw new TypeError('fill-range: first range argument is incompatible with second.'); | ||
} | ||
if (isNumber(a) && !isNumber(b)) { | ||
throw new TypeError('fill-range: incompatible range arguments.'); | ||
throw new TypeError('fill-range: first range argument is incompatible with second.'); | ||
} | ||
@@ -112,0 +116,0 @@ if (step && (!isNumber(step) && !/>/.test(step))) { |
{ | ||
"name": "fill-range", | ||
"description": "Fill in a range of numbers or letters, optionally passing an increment or multiplier to use.", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"homepage": "https://github.com/jonschlinkert/fill-range", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -154,2 +154,2 @@ # fill-range [![NPM version](https://badge.fury.io/js/fill-range.svg)](http://badge.fury.io/js/fill-range) | ||
_This file was generated by [verb](https://github.com/assemble/verb) on January 04, 2015._ | ||
_This file was generated by [verb](https://github.com/assemble/verb) on January 08, 2015._ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Unmaintained
MaintenancePackage has not been updated in more than 5 years and may be unmaintained. Problems with the package may go unaddressed.
Found 1 instance in 1 package
8848
124
0
0
33
1
1
1
1