What is the purpose of 'require.paths.unshift()' in Node.js? - node.js

I'm new to javascript and NodeJS and I've been looking at a bit of deprecated code and I've come across 'require.paths.unshift()' on many occasions at the start of a file. To my understanding, this syntax has been long removed from NodeJS, but in order for me to understand and potentially fix up the old code, I need to understand it's meaning and context.
I've tried looking for it online but I couldn't find much on it. If someone could please explain the context of it's use or a newer implementation, I'd much appreciate it.

Related

WHY is the fs.rmdir recursive option experimental?

I see that since version 12, NodeJS has had a recursive option on the fs.rmdir function to allow removal of non-empty directories from the file system. Why is this feature marked "experimental" in the documentation? Does it work or doesn't it? The documentation doesn't say what level of concern to have over this, or under what circumstances.
I found Christopher Hiller's article explaining the difficulties that went into creating an efficient implementation of this, but he doesn't explain the "experimental" designation. Maybe the problem isn't that it doesn't work, or doesn't always work, but that it can be a bottleneck under certain circumstances? I'm trying to decide whether to depend on it or not, rather than writing my own code that's going to have exactly the same pitfalls Hiller encountered, so if anyone here has any insight, I'd appreciate it!

Setting up Multithreading in Spotfire

I am trying to set up a multi threading code for Spotfire. I was wondering if anyone can help me set up a basic one, since I couldnt find any place explaining how to do it. I was able to find this thread talking about setting one up, but I couldnt understand how to set up the code. Also I am using Spotfire v7.11 in case future versions have made it easier to have multithreading work.
I have tried creating a simple thread function as seen here but that kept crashing the code. Thank you for all of your help.

Is it problematic if wolkenkit (or any) event-sourced events are unstructured?

It seems a bit odd to me that events are not structured in Wolkenkit. Coming from the Commanded library in Elixir, one of the first things I did after event-storming was to create my Command and Event types. I understand this is how js traditionally behaves, but just having it just defined in the aggregate will take some getting used to.
"Is it problematic […]?"
Well, this is hard to answer, since it highly depends on your (subjective) definition of problematic. Basically, you already have the answer by yourself:
"I understand this is how js traditionally behaves […]"
That.
To get a better understanding of how commands and events in wolkenkit are structured internally, you might be interested in having a look at the npm module commands-events, which contains the basic data types.
From my very own experience (10 years of C#, 7 years of JavaScript) I can tell you that the missing static type system of JavaScript was never a problem for me, but this is just my highly personal experience.
As you said, it may take some time to get used to it, but you gain an incredible flexibility by this as well.
HTH
Please note that I am one of the developers of wolkenkit, so please take my answer with a grain of salt.

How to manage imports in typescript?

So I've recently started using Typescript. Both for the back end (nodejs) and front end, and I'm started to feel an urge to chew on my own arm every time I have to add a new import.
Coming from the .NET world the last 15 years I've come to appreciate the more or less automatic type resolving. Especially with a background in C/C++, which whenever I return to, remind me of the #include hell that ever so often becomes the case. Given what I am now facing, I get a feeling of "those were the days".
I typically prefer to keep my code as one class -> one file (with some obv exceptions for smaller stuff). This results in a lot of files and even more imports. I recently discovered some tools that help out creating the imports but it is still really annoying.
I get it that the underlying JS needs these imports (in various ways depending on module system) But given how easy these tools resolves the imports. Would it not be possible for the compiler to simply generate them? In the rare case of ambiguity the compiler would simple give an error and the user needs to resolve it manually.
Typescript seems to be a great language otherwise but this is really close to a deal breaker for me. Or am I missing something? Can this be done in a better way?

Is there a good auto-complete search library that I can use?

I already tried cleo, not convinced majorly because of this bug that I recently encountered and yet have been unable to solve.
Also tried elasticsearch, but too complex to run even a single query and indexing and other features were pretty slow too.
So if anyone knows another better one or something I am missing out here in these two. Thanks.
Have you tried the Completion Suggester API? It is not complex and certainly not slow.

Resources