Comparing version 0.4.0 to 0.4.1
@@ -18,5 +18,6 @@ var ModuleReference = require('./ModuleReference'); | ||
for(var i in modulesInfo) { | ||
if(!modulesInfo.hasOwnProperty(i)) continue; | ||
var ref = new ModuleReference(modulesInfo[i]); | ||
this._moduleRefs[ref.alias] = ref; | ||
if(modulesInfo.hasOwnProperty(i)) { | ||
var ref = new ModuleReference(modulesInfo[i]); | ||
this._moduleRefs[ref.alias] = ref; | ||
} | ||
} | ||
@@ -33,4 +34,5 @@ }; | ||
for(var key in beat[itemToImport]) { | ||
if(!beat[itemToImport].hasOwnProperty(key)) continue; | ||
self[itemToImport][key] = beat[itemToImport][key]; | ||
if(beat[itemToImport].hasOwnProperty(key)) { | ||
self[itemToImport][key] = beat[itemToImport][key]; | ||
} | ||
} | ||
@@ -41,4 +43,4 @@ }); | ||
Beat.prototype.value = function value(alias, value) { | ||
this._properties[generateAlias(alias)] = value; | ||
Beat.prototype.value = function value(alias, property) { | ||
this._properties[generateAlias(alias)] = property; | ||
return this; | ||
@@ -55,11 +57,12 @@ }; | ||
for(var a in this._moduleRefs) { | ||
if(!this._moduleRefs.hasOwnProperty(a)) continue; | ||
var module = this._moduleRefs[a].module; | ||
if(module instanceof Beat) { | ||
this.load(module); | ||
if(this._moduleRefs.hasOwnProperty(a)) { | ||
var module = this._moduleRefs[a].module; | ||
if(module instanceof Beat) { | ||
this.load(module); | ||
} | ||
else { | ||
this._properties[generateAlias(a)] = module; | ||
} | ||
delete this._moduleRefs[a]; | ||
} | ||
else { | ||
this._properties[generateAlias(a)] = module; | ||
} | ||
delete this._moduleRefs[a]; | ||
} | ||
@@ -66,0 +69,0 @@ var alreadyResolving = this._stack.contains(alias); |
var Errors = require('./Errors'); | ||
var BeatError = Errors.BeatError; | ||
var Block = module.exports = function Block(fn, deps) { | ||
module.exports = function Block(fn, deps) { | ||
if(deps instanceof Array) { | ||
@@ -14,9 +14,9 @@ fn._deps = deps; | ||
var match = fn.toString().match(/^function\s*[^\(]*\(\s*([^\)]*)\)/m); | ||
var deps = match && match[1] && match[1].split(',').map(function(arg) { | ||
var extractedDeps = match && match[1] && match[1].split(',').map(function(arg) { | ||
var match = arg.match(/\/\*([^\*]*)\*\//m); | ||
return match ? match[1].trim() : arg.trim(); | ||
}) || []; | ||
return new Block(fn, deps); | ||
return new Block(fn, extractedDeps); | ||
} | ||
throw new BeatError('Can not resolve block "'+fn+'". Expected a function.'); | ||
}; |
@@ -1,6 +0,5 @@ | ||
var util = require('util'); | ||
var Errors = require('./Errors'); | ||
var BeatError = Errors.BeatError; | ||
var generateAlias = module.exports = function generateAlias(aliasCandidate) { | ||
module.exports = function generateAlias(aliasCandidate) { | ||
if(typeof aliasCandidate !== 'string' && typeof aliasCandidate !== 'number') { | ||
@@ -7,0 +6,0 @@ throw new BeatError('Invalid key "'+aliasCandidate+'". Expected string or number.'); |
@@ -27,4 +27,5 @@ var generateAlias = require('./generateAlias'); | ||
for(var alias in this.info) { | ||
if(!this.info.hasOwnProperty(alias)) continue; | ||
return generateAlias(alias); | ||
if(this.info.hasOwnProperty(alias)) { | ||
return generateAlias(alias); | ||
} | ||
} | ||
@@ -38,4 +39,5 @@ throw new BeatError('Can not resolve alias for module reference "'+this.info+'". Expected a string or plain object.'); | ||
for(var alias in this.info) { | ||
if(!this.info.hasOwnProperty(alias)) continue; | ||
reference = this.info[alias]; | ||
if(this.info.hasOwnProperty(alias)) { | ||
reference = this.info[alias]; | ||
} | ||
break; | ||
@@ -42,0 +44,0 @@ } |
@@ -6,3 +6,3 @@ { | ||
"repository": "git://github.com/edinella/beat.git", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"license": "MIT", | ||
@@ -9,0 +9,0 @@ "main": "lib/Beat.js", |
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
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
480
0
22652