mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-12 12:59:57 +00:00
Make the linter happy (#8210)
This commit is contained in:
parent
18d23048da
commit
074d35c388
32
boot/boot.js
32
boot/boot.js
@ -142,15 +142,15 @@ $tw.utils.each = function(object,callback) {
|
||||
var next,f,length;
|
||||
if(object) {
|
||||
if(Object.prototype.toString.call(object) == "[object Array]") {
|
||||
for (f=0, length=object.length; f<length; f++) {
|
||||
for(f=0, length=object.length; f<length; f++) {
|
||||
next = callback(object[f],f,object);
|
||||
if(next === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var keys = Object.keys(object);
|
||||
for (f=0, length=keys.length; f<length; f++) {
|
||||
for(f=0, length=keys.length; f<length; f++) {
|
||||
var key = keys[f];
|
||||
next = callback(object[key],key,object);
|
||||
if(next === false) {
|
||||
@ -275,7 +275,7 @@ Extend an object with the properties from a list of source objects
|
||||
$tw.utils.extend = function(object /*, sourceObjectList */) {
|
||||
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
|
||||
if(source) {
|
||||
for (var p in source) {
|
||||
for(var p in source) {
|
||||
object[p] = source[p];
|
||||
}
|
||||
}
|
||||
@ -289,7 +289,7 @@ Fill in any null or undefined properties of an object with the properties from a
|
||||
$tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
|
||||
$tw.utils.each(Array.prototype.slice.call(arguments,1),function(source) {
|
||||
if(source) {
|
||||
for (var p in source) {
|
||||
for(var p in source) {
|
||||
if(object[p] === null || object[p] === undefined) {
|
||||
object[p] = source[p];
|
||||
}
|
||||
@ -893,8 +893,8 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
||||
} else {
|
||||
/*
|
||||
CommonJS optional require.main property:
|
||||
In a browser we offer a fake main module which points back to the boot function
|
||||
(Theoretically, this may allow TW to eventually load itself as a module in the browser)
|
||||
In a browser we offer a fake main module which points back to the boot function
|
||||
(Theoretically, this may allow TW to eventually load itself as a module in the browser)
|
||||
*/
|
||||
Object.defineProperty(sandbox.require, "main", {
|
||||
value: (typeof(require) !== "undefined") ? require.main : {TiddlyWiki: _boot},
|
||||
@ -936,9 +936,9 @@ $tw.modules.execute = function(moduleName,moduleRoot) {
|
||||
moduleInfo.exports = moduleInfo.definition;
|
||||
}
|
||||
} catch(e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
if(e instanceof SyntaxError) {
|
||||
var line = e.lineNumber || e.line; // Firefox || Safari
|
||||
if (typeof(line) != "undefined" && line !== null) {
|
||||
if(typeof(line) != "undefined" && line !== null) {
|
||||
$tw.utils.error("Syntax error in boot module " + name + ":" + line + ":\n" + e.stack);
|
||||
} else if(!$tw.browser) {
|
||||
// this is the only way to get node.js to display the line at which the syntax error appeared,
|
||||
@ -1533,7 +1533,7 @@ Define all modules stored in ordinary tiddlers
|
||||
$tw.Wiki.prototype.defineTiddlerModules = function() {
|
||||
this.each(function(tiddler,title) {
|
||||
if(tiddler.hasField("module-type")) {
|
||||
switch (tiddler.fields.type) {
|
||||
switch(tiddler.fields.type) {
|
||||
case "application/javascript":
|
||||
// We only define modules that haven't already been defined, because in the browser modules in system tiddlers are defined in inline script
|
||||
if(!$tw.utils.hop($tw.modules.titles,tiddler.fields.title)) {
|
||||
@ -2043,7 +2043,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
||||
arrayOfFiles = arrayOfFiles || [];
|
||||
var files = fs.readdirSync(dirPath);
|
||||
files.forEach(function(file) {
|
||||
if (recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {
|
||||
if(recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {
|
||||
arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);
|
||||
} else if(fs.statSync(dirPath + path.sep + file).isFile()){
|
||||
arrayOfFiles.push(path.join(dirPath, path.sep, file));
|
||||
@ -2283,7 +2283,7 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
|
||||
}
|
||||
$tw.wiki.addTiddlers(tiddlerFile.tiddlers);
|
||||
});
|
||||
if ($tw.boot.wikiPath == wikiPath) {
|
||||
if($tw.boot.wikiPath == wikiPath) {
|
||||
// Save the original tiddler file locations if requested
|
||||
var output = {}, relativePath, fileInfo;
|
||||
for(var title in $tw.boot.files) {
|
||||
@ -2637,14 +2637,14 @@ $tw.boot.doesTaskMatchPlatform = function(taskModule) {
|
||||
var platforms = taskModule.platforms;
|
||||
if(platforms) {
|
||||
for(var t=0; t<platforms.length; t++) {
|
||||
switch (platforms[t]) {
|
||||
switch(platforms[t]) {
|
||||
case "browser":
|
||||
if ($tw.browser) {
|
||||
if($tw.browser) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case "node":
|
||||
if ($tw.node) {
|
||||
if($tw.node) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@ -2727,7 +2727,7 @@ Invoke the hook by key
|
||||
$tw.hooks.invokeHook = function(hookName /*, value,... */) {
|
||||
var args = Array.prototype.slice.call(arguments,1);
|
||||
if($tw.utils.hop($tw.hooks.names,hookName)) {
|
||||
for (var i = 0; i < $tw.hooks.names[hookName].length; i++) {
|
||||
for(var i = 0; i < $tw.hooks.names[hookName].length; i++) {
|
||||
args[0] = $tw.hooks.names[hookName][i].apply(null,args);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user