Comparing version 0.1.1 to 0.2.0
@@ -0,0 +0,0 @@ # 0.1.1 - April 7, 2015 |
{ | ||
"name": "hairballs", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Shared utilities for Lint Reporters", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"dependencies": { | ||
"handlebars": "4.0.5" | ||
"handlebars": "4.0.13" | ||
}, | ||
@@ -34,0 +34,0 @@ "devDependencies": { |
@@ -0,0 +0,0 @@ # Shared Libraries for Lint Reporters |
@@ -21,4 +21,4 @@ 'use strict'; | ||
exports.errorOccurances = []; | ||
exports.warningOccurances = []; | ||
exports.errorOccurrences = []; | ||
exports.warningOccurrences = []; | ||
@@ -91,8 +91,8 @@ /** | ||
/** | ||
* Helper for sorting occurances | ||
* Helper for sorting occurrences | ||
* @param {object} a - First object to compare | ||
* @param {object} b - Second object to compare | ||
* @returns {int} - Value used to sort the occurances | ||
* @returns {int} - Value used to sort the occurrences | ||
*/ | ||
exports.sortOccurances = function(a, b) { | ||
exports.sortOccurrences = function(a, b) { | ||
return b.count - a.count; | ||
@@ -103,24 +103,24 @@ }; | ||
/** | ||
* Count the occurances of an alert | ||
* Count the occurrences of an alert | ||
* @param {string} key - Linting rule | ||
* @param {array} severity - Array of occurances | ||
* @param {array} severity - Array of occurrences | ||
* @param {string|boolean} ruleUrl - URL of rule for reference | ||
* @returns {void} | ||
*/ | ||
exports.updateOccurance = function(key, severity, ruleUrl) { | ||
var foundOccurance = false; | ||
exports.updateOccurrence = function(key, severity, ruleUrl) { | ||
var foundOccurrence = false; | ||
var occurances = (severity === 'error' || severity === 2) | ||
? this.errorOccurances : this.warningOccurances; | ||
var occurrences = (severity === 'error' || severity === 2) | ||
? this.errorOccurrences : this.warningOccurrences; | ||
for (var x = 0; x < occurances.length; x++) { | ||
if (occurances[x].name === key) { | ||
foundOccurance = true; | ||
occurances[x].count++; | ||
for (var x = 0; x < occurrences.length; x++) { | ||
if (occurrences[x].name === key) { | ||
foundOccurrence = true; | ||
occurrences[x].count++; | ||
} | ||
} | ||
if (!foundOccurance) { | ||
occurances.push({ name: key, count: 1, ruleUrl: ruleUrl}); | ||
if (!foundOccurrence) { | ||
occurrences.push({ name: key, count: 1, ruleUrl: ruleUrl}); | ||
} | ||
}; |
@@ -0,0 +0,0 @@ /** |
@@ -86,4 +86,4 @@ /** | ||
// occurances | ||
var occurances = fs.readFileSync(path.join(partialsPath, 'occurances.hbs'), | ||
// occurrences | ||
var occurrences = fs.readFileSync(path.join(partialsPath, 'occurrences.hbs'), | ||
{ encoding: 'utf-8' } | ||
@@ -105,3 +105,3 @@ ); | ||
fileBreakdown: handlebars.compile(fileBreakdown), | ||
occurances: handlebars.compile(occurances), | ||
occurrences: handlebars.compile(occurrences), | ||
js: handlebars.compile(js), | ||
@@ -108,0 +108,0 @@ css: handlebars.compile(css) |
@@ -92,3 +92,3 @@ 'use strict'; | ||
describe('sortOccurances(a, b)', function() { | ||
describe('sortOccurrences(a, b)', function() { | ||
it('should sort', function() { | ||
@@ -98,3 +98,3 @@ var a1 = { count: 4 }; | ||
expect(index.sortOccurances(a1, b1)).to.equal(-1); | ||
expect(index.sortOccurrences(a1, b1)).to.equal(-1); | ||
@@ -104,3 +104,3 @@ var a2 = { count: 5 }; | ||
expect(index.sortOccurances(a2, b2)).to.equal(1); | ||
expect(index.sortOccurrences(a2, b2)).to.equal(1); | ||
@@ -110,32 +110,32 @@ var a3 = { count: 2 }; | ||
expect(index.sortOccurances(a3, b3)).to.equal(0); | ||
expect(index.sortOccurrences(a3, b3)).to.equal(0); | ||
}); | ||
}); | ||
describe('updateOccurance(key, severity, ruleUrl)', function() { | ||
it('should update error occurances', function() { | ||
index.updateOccurance('errorKey', 'error', 'url.html'); | ||
describe('updateOccurrence(key, severity, ruleUrl)', function() { | ||
it('should update error occurrences', function() { | ||
index.updateOccurrence('errorKey', 'error', 'url.html'); | ||
expect(index.errorOccurances[0].name).to.equal('errorKey'); | ||
expect(index.errorOccurances[0].count).to.equal(1); | ||
expect(index.errorOccurances[0].ruleUrl).to.equal('url.html'); | ||
expect(index.errorOccurrences[0].name).to.equal('errorKey'); | ||
expect(index.errorOccurrences[0].count).to.equal(1); | ||
expect(index.errorOccurrences[0].ruleUrl).to.equal('url.html'); | ||
index.updateOccurance('errorKey', 2, 'url.html'); | ||
index.updateOccurance('errorKey', 'error', 'url.html'); | ||
index.updateOccurrence('errorKey', 2, 'url.html'); | ||
index.updateOccurrence('errorKey', 'error', 'url.html'); | ||
expect(index.errorOccurances[0].count).to.equal(3); | ||
expect(index.errorOccurrences[0].count).to.equal(3); | ||
}); | ||
it('should update warning occurances', function() { | ||
index.updateOccurance('warningKey', 'warning', 'url.html'); | ||
it('should update warning occurrences', function() { | ||
index.updateOccurrence('warningKey', 'warning', 'url.html'); | ||
expect(index.warningOccurances[0].name).to.equal('warningKey'); | ||
expect(index.warningOccurances[0].count).to.equal(1); | ||
expect(index.warningOccurances[0].ruleUrl).to.equal('url.html'); | ||
expect(index.warningOccurrences[0].name).to.equal('warningKey'); | ||
expect(index.warningOccurrences[0].count).to.equal(1); | ||
expect(index.warningOccurrences[0].ruleUrl).to.equal('url.html'); | ||
index.updateOccurance('warningKey', 1, 'url.html'); | ||
index.updateOccurance('warningKeyOther', 1, 'url.html'); | ||
index.updateOccurrence('warningKey', 1, 'url.html'); | ||
index.updateOccurrence('warningKeyOther', 1, 'url.html'); | ||
expect(index.warningOccurances[0].count).to.equal(2); | ||
expect(index.warningOccurances[1].count).to.equal(1); | ||
expect(index.warningOccurrences[0].count).to.equal(2); | ||
expect(index.warningOccurrences[1].count).to.equal(1); | ||
}); | ||
@@ -142,0 +142,0 @@ }); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -28,4 +28,4 @@ 'use strict'; | ||
summary: summary, | ||
warningOccurances: [], | ||
errorOccurances: [], | ||
warningOccurrences: [], | ||
errorOccurrences: [], | ||
files: [], | ||
@@ -32,0 +32,0 @@ fullReport: false, |
@@ -0,0 +0,0 @@ 'use strict'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
35758
21
+ Addedasync@2.6.4(transitive)
+ Addedhandlebars@4.0.13(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addeduglify-js@3.19.3(transitive)
- Removedalign-text@0.1.4(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedasync@1.5.2(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedcenter-align@0.1.3(transitive)
- Removedcliui@2.1.0(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedhandlebars@4.0.5(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedkind-of@3.2.2(transitive)
- Removedlazy-cache@1.0.4(transitive)
- Removedlongest@1.0.1(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedright-align@0.1.3(transitive)
- Removedsource-map@0.4.40.5.7(transitive)
- Removeduglify-js@2.8.29(transitive)
- Removeduglify-to-browserify@1.0.2(transitive)
- Removedwindow-size@0.1.0(transitive)
- Removedwordwrap@0.0.2(transitive)
- Removedyargs@3.10.0(transitive)
Updatedhandlebars@4.0.13