data-templater
Advanced tools
Comparing version 0.5.0 to 0.5.1
28
index.js
@@ -81,9 +81,19 @@ var dataMasker = {}; | ||
maskCharacter = maskCharacter || '?'; | ||
var newIndex = -1; | ||
var newIndex = 0; | ||
var currentIndex = 0; | ||
var countDown = index; | ||
var decreaseIndex = false; | ||
do { | ||
while (countDown >= 0) { | ||
if (mask[currentIndex] === maskCharacter) { | ||
newIndex += 1; | ||
decreaseIndex = false; | ||
//NOTE: need to account for end of string index finding | ||
} else if (mask[currentIndex] === undefined) { | ||
newIndex += 1; | ||
countDown = 0; | ||
decreaseIndex = false; | ||
} else { | ||
//NOTE | ||
decreaseIndex = true; | ||
} | ||
@@ -93,4 +103,8 @@ | ||
countDown -= 1; | ||
} while (countDown >= 0) | ||
} | ||
if(decreaseIndex === false) { | ||
newIndex -= 1; | ||
} | ||
if (newIndex < 0) { | ||
@@ -105,7 +119,7 @@ newIndex = 0; | ||
maskCharacter = maskCharacter || '?'; | ||
var newIndex = -1; | ||
var newIndex = 0; | ||
var countDown = index; | ||
var tempBeginningIndex = 0; | ||
do { | ||
while (countDown >= 0) { | ||
if (mask[newIndex] === maskCharacter) { | ||
@@ -119,6 +133,6 @@ countDown -= 1; | ||
if (newIndex >= (mask.length - 1)) { | ||
if (newIndex >= mask.length) { | ||
countDown = -1; | ||
} | ||
} while (countDown >= 0) | ||
} | ||
@@ -125,0 +139,0 @@ if (newIndex < 0) { |
{ | ||
"name": "data-templater", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Data templater for JavaScript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -61,8 +61,8 @@ describe('data templater', function() { | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(3, '(???) ???-????')).to.equal(2); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(4, '(???) ???-????')).to.equal(2); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(5, '(???) ???-????')).to.equal(2); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(4, '(???) ???-????')).to.equal(3); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(5, '(???) ???-????')).to.equal(3); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(6, '(???) ???-????')).to.equal(3); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(7, '(???) ???-????')).to.equal(4); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(8, '(???) ???-????')).to.equal(5); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(9, '(???) ???-????')).to.equal(5); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(9, '(???) ???-????')).to.equal(6); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(10, '(???) ???-????')).to.equal(6); | ||
@@ -72,2 +72,3 @@ expect(dataTemplater.compiledIndexToUncompiledIndex(11, '(???) ???-????')).to.equal(7); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(13, '(???) ???-????')).to.equal(9); | ||
expect(dataTemplater.compiledIndexToUncompiledIndex(14, '(???) ???-????')).to.equal(10); | ||
}); | ||
@@ -86,4 +87,5 @@ | ||
expect(dataTemplater.uncompiledIndexToCompiledIndex(9, '(???) ???-????')).to.equal(13); | ||
expect(dataTemplater.uncompiledIndexToCompiledIndex(10, '(???) ???-????')).to.equal(14); | ||
}); | ||
}); | ||
}); |
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
12129
196