Skip to content

Commit

Permalink
Do not pass settings object to handlers.
Browse files Browse the repository at this point in the history
  • Loading branch information
theakman2 committed Feb 15, 2014
1 parent 0b4cc85 commit 739de1e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions lib/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ function fetch(str) {
throw new Error("Handler '" + str + "' not found. " +
"Are you sure the package 'webant-handler-" + str + "' is installed?");
}
if (!(handler.defaultSettings && typeof handler.defaultSettings === "object")) {
handler.defaultSettings = {};
if (!(handler.settings && typeof handler.settings === "object")) {
handler.settings = {};
}
return handler;
}
Expand All @@ -25,8 +25,8 @@ function _get(data,into) {
}
} else if (typeof data.willHandle === "function" && typeof data.handle === "function") {
if (into.indexOf(data) === -1) {
if (!(data.defaultSettings && typeof data.defaultSettings === "object")) {
data.defaultSettings = {};
if (!(data.settings && typeof data.settings === "object")) {
data.settings = {};
}
into.push(data);
}
Expand All @@ -39,7 +39,7 @@ function _get(data,into) {
for (var key in data) {
if (data.hasOwnProperty(key)) {
var handler = fetch(key);
extend(handler.defaultSettings,data[key]);
extend(handler.settings,data[key]);
if (into.indexOf(handler) === -1) {
into.push(handler);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/jsHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var path = require("path");
var url = require("url");

module.exports = {
defaultSettings:{},
settings:{},
willHandle:function(filePath,settings){
if (url.parse(filePath,false,true).host) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions lib/rawToAsts.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function rawToAsts(opts,callback) {
var canHandle = null;

for (var i = 0; i < _handlers.length; i++) {
if (_handlers[i].willHandle(filePath,_handlers[i].defaultSettings)) {
if (_handlers[i].willHandle(filePath)) {
canHandle = _handlers[i];
break;
}
Expand All @@ -95,7 +95,7 @@ function rawToAsts(opts,callback) {
return;
}

canHandle.handle(filePath,canHandle.defaultSettings,function(err,content){
canHandle.handle(filePath,function(err,content){
if (err) {
ancestry.shift();
complete(err);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webant",
"version": "3.0.1",
"version": "4.0.0",
"description": "Bringing CommonJS-style requires to the browser and more.",
"keywords":[
"ant",
Expand Down

0 comments on commit 739de1e

Please sign in to comment.