Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10360766
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
965 B
Referenced Files
None
Subscribers
None
View Options
diff --git a/index.js b/index.js
index 531230c..4a7a345 100644
--- a/index.js
+++ b/index.js
@@ -1,32 +1,34 @@
+"use strict";
+
const path = require("path");
const fs = require("fs");
function fileExists(filePath) {
try {
return fs.statSync(filePath).isFile();
} catch (err) {
return false;
}
};
function search_for_file_upwards(start, filename){
let current_path = path.resolve(start, "./" + filename)
while(!fileExists(current_path)){
current_path = path.resolve(current_path, "../../" + filename);
}
return current_path;
};
function locreq(caller_path, module_path){
const package_path = search_for_file_upwards(caller_path, "package.json");
const to_require = path.resolve(package_path, "../", module_path);
return require(to_require);
};
function curry_locreq(caller_path){
return function(module_path){
return locreq(caller_path, module_path);
};
};
module.exports = curry_locreq;
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 8, 08:36 (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1033524
Default Alt Text
(965 B)
Attached To
Mode
rLQ locreq
Attached
Detach File
Event Timeline
Log In to Comment