Skip to content

Commit

Permalink
Use strict equality
Browse files Browse the repository at this point in the history
  • Loading branch information
MadLittleMods committed Jan 22, 2015
1 parent 0f48cd5 commit 0578c6c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ var spriter = function(options) {
// Filter out any declartion with the `include: false` meta
chunkBackgroundImageDeclarations = chunkBackgroundImageDeclarations.filter(function(declaration) {
var metaIncludeValue = (declaration.meta && declaration.meta.spritesheet && declaration.meta.spritesheet.include);
var shouldIncludeBecauseImplicit = settings.includeMode == 'implicit' && (metaIncludeValue === undefined || metaIncludeValue);
var shouldIncludeBecauseExplicit = settings.includeMode == 'explicit' && metaIncludeValue;
var shouldIncludeBecauseImplicit = settings.includeMode === 'implicit' && (metaIncludeValue === undefined || metaIncludeValue);
var shouldIncludeBecauseExplicit = settings.includeMode === 'explicit' && metaIncludeValue;
var shouldInclude = shouldIncludeBecauseImplicit || shouldIncludeBecauseExplicit;

// Only return declartions that shouldn't be skipped
Expand Down
7 changes: 4 additions & 3 deletions lib/get-all-background-image-declarations.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ function getAllBackgroundImageDeclarations(styles) {
// Get all the declarations that have background `url()` declarations
var backgroundImageDeclarations = [];
styles.stylesheet.rules.forEach(function(rule) {
if(rule.type == 'rule') {
if(rule.type === 'rule') {
rule.declarations.forEach(function(declaration, declarationIndex) {
// background-image always has a url
if(declaration.property == 'background-image') {
if(declaration.property === 'background-image') {
backgroundImageDeclarations.push(attachInfoToDeclaration(rule, declarationIndex));
}
// Background is a shorthand property so make sure `url()` is in there
else if(declaration.property == 'background') {
else if(declaration.property === 'background') {
var hasImageValue = spriterUtil.backgroundURLRegex.test(declaration.value);

if(hasImageValue) {
Expand All @@ -42,6 +42,7 @@ function attachInfoToDeclaration(rule, declarationIndex)
var declarationMetaInfo = getMetaInfoForDeclaration(rule, declarationIndex);

// Add the meta into to the declaration
// Check for null or undefined
if(declaration.meta == null) {
declaration.meta = {};
}
Expand Down
4 changes: 2 additions & 2 deletions lib/get-meta-info-for-declaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getMetaInfoForDeclaration(rule, declarationIndex) {
//console.log(afterDeclaration);
//console.log(afterDeclaration.position.start.line, mainDeclaration.position.start.line);
// Make sure that the comment starts on the same line as the main declaration
if(afterDeclaration.position.start.line == mainDeclaration.position.start.line) {
if(afterDeclaration.position.start.line === mainDeclaration.position.start.line) {
extend(resultantMetaData, parseCommentDecarationForMeta(afterDeclaration));
}
}
Expand All @@ -39,7 +39,7 @@ function getMetaInfoForDeclaration(rule, declarationIndex) {


function parseCommentDecarationForMeta(declaration) {
if(declaration.type == "comment")
if(declaration.type === "comment")
{
//console.log(declaration);

Expand Down

0 comments on commit 0578c6c

Please sign in to comment.