Library extensions (both for command line and web browser)
Usable in Node.js and your web browsers (I'll publish my web example(s) and my new
homepage code later.. and also the rest of my whole project with it's apps - whichare web and console projects ;-)
Loading modules in the browser environment is possible, too. Those are all the
same modules as for the regular console environment, I thought about cross
compatibility (later there will be even more..).
Look into "main.js" at "require()", "include()" and "register()". .. and remember:
use "/" for importing and "." for exporting.. but see for yourself in my code...
I realized there are some own functions etc. for the most used base classes (like
Array, Object, String, etc..) that I use in nearly any project. Extend it as you
need/wish to.
Extended the "BigInt" object. As I usually need large radix conversions, which are
not limited to 36 (Number maximum). So we can parse() and render() any Bytecode/
String now!
Hint: w/o using many arguments you can parse('(2)10101010'); e.g.. so some type
of "cast" prefix can be used to decide which radix to use. ;-)
These first two are (nearly) the same, while the last both convert back to string,
where (true) produces the '(2)' cast prefix.. and the last line demonstrates the
conversion to a real byte-code! ;-)
var big = parse([15,15,15,15], 16);
big = BigInt.parse('(16)ffff');
big.render(2, true);
big.render(256);
There are some other possibilities, including a switch whether to use an alphabet
or directly use the "digits" as ASCII/UTF says.. etc. ...
Please do not use '.prototype' in your further implementations. Do like it is ..
... as we get this prototype of the 'arguments' object by:
Arguments = (function() { return arguments.__proto__; })();
Instead of using "require('lib.js')" in your scripts, just put a symlink to this
repository at "bin/node.js", which will always use this "lib.js". It just loads
this library plus the script in "process.argv".. use it as regular Shebang, pls.
#!/usr/bin/env node.js
To easily check for newer official versions (the development branch..), you can
use my script "bin/version.js". ..
... just sudo ln -s /home/$USER/lib.js/bin/version.js! Same with "node.js", see
the sub section above this one. :-)
... will follow later.. very late. But you just need to take a look to the code!
MIT License.
Copyright (c) 2019 Sebastian "Kuchen" Kucharczyk