Every JavaScript is made by myself, arose out of necessity.. or because I found it interesting.
Many moved to here from my original
Scripts repository,
which now only serves bash
shell scripts.
Most should work 'as is', maybe also in your web browser,
maybe with Node.js (whereas at this
time(!) I'm usually working with CommonJS modules, using
import
and export
). So maybe you also want my own
package.json
?
Note
For the future I'm planning to sort all the scripts in here by their line counts. JFYI..
Note
JFYI: I really dislike npm.js and the inclusion of so many modules I could write by myself as well. Don't expect me to use it..!
- [2025-05-31] Updated the
reflection
.js, v3.3.0; - [2025-05-24] Update in my deep-
clone
.js, v0.7.0; - [2025-05-23] Updated the
mode
.js, v0.4.2; - [2025-05-18] Link to my
levenshtein
.js; - [2025-01-14] Created
newlines
.js, v0.1.0; - [2025-01-10] Update in my
config
.js, to v0.8.0; - [2024-12-24] Uploaded my
chess
.js, v0.2.1; - [2024-12-13] Updated
fill
.js, now v0.1.1; - [2024-12-03] Created
bytes
.js, v0.1.0; - [2024-11-26] Created
escaping
.js, v0.2.0; - [2024-11-05] Updated the new
measure
.js to v0.2.1; - [2024-09-24] Moved the
offset
.js script to my newutilities
repository; - [2024-09-24] Created this repository, to move only the JavaScripts from my
scripts
repository to here.
My favorite language.. absolutely. ^_^
Many, many years ago I just laughed about JavaScript, because it was just some 'browser scripting language'..
TODAY, in the times of Node.js
, it's a great language, even for the server side! ;-)
Every script is made by myself, arose out of necessity.. or because I found it interesting.
Got it's own repository dump.js
With this script, you can calculate and convert between offsets and lines with columns, or count them, etc. Without any parameter it'll show you the whole countings, and with another parameter combination you can even get to know how many columns a specific line has.
- Version v1.0.2 (updated 2024-10-06)
Tip
Start with the argv parameter --help
or -?
. ;-)
- Version v0.7.0 (updated 2025-05-24)
My Reflect.clone()
extension, because JavaScript doesn't support
DEEP cloning natively.
.. and it works great, really! :-) Also checks Reflect.isExtensible()
,
so even functions with extensions are being fully cloned. The functions 'per se'
can also be cloned (optionally, if not 'native' ones).
Without circular dependencies since I'm using a Map
to just return any item which has already been cloned.
- Version v0.8.0 (updated 2025-01-10)
Using a regular .json
file/structure. But with improved handling.
Important
It ain't runnable in a regular JavaScript environment, since it's using extensions I've only got in my own code. But the algorithms and structures should be correct and clear when you are looking in the code for yourself.
Example given: { server: { host: 'localhost', { http: { port: 8080 } } } };
You can .get('server.http.host');
and nevertheless get the host
above it.
It's possible to receive an array with all upper definitions, and via _index
argument to select one (-1 for the last, deepest one, e.g.). You can also FORCE
a concrete item without parents, see '.force()'.
The .with()
function is meant for e.g. { enabled: (bool) }. It checks all upper
occurencies, if there's at least one (false/true
) value. So you can 'globally'
disable/enable smth., even if deeper occurencies enable smth. I needed/wanted this;
.. usable by .enabled()
and .disabled()
(chooses the test with one of true/false
).
You can, btw., init with config object using {,static} wrap(_object, ..)
;
or just argue with such a base object in any constructor argument. AND now
you can also .extend()
with kinda 'chroot' sub paths (so your query paths
can start in a sub object).. and now, since v0.6.0 I also support the
'step-wise' traversing up the paths. So not only any chroot path, but every
path item (see Configuration.delim
)!
- Version v0.8.3 (updated 2024-05-02)
This class extracts all links from .html
files. It should work better than
regular expressions, since it covers many possible codes. And this class should
be instanciated, so it also works with file chunks (this way, the input data does
not have to be complete, which is great for streams; also to save memory, etc.).
And see the DEFAULT_ATTRIBS = [ 'href', 'src' ];
; or maybe define a filter,
like the DEFAULT_SCHEME = [ 'http:', 'https:' ]
, so only these links will
remain in the result array; you can also instanciate with a source
param
or attrib: from which URL this HTML document comes from, so the links are
adapted to it (relative links could be a problem otherwise).
Since v0.4.0 also with DEFAULT_UNIQUE = true
; extra .extract()
function
(original .onData()
was meant for stream events); plus some improvements and
bugs fixed. And more big changes since v0.5.0.
PLUS: since v0.8.0 it can extract ALL links, not only those from HTML codes;
e.g. text/plain
; BUT you need (beneath .all
or DEFAULT_ALL
) also at least
one .scheme[]
item..
Nice one; have phun.
- Version v0.1.0 (created 2024-12-03)
This is radix/base conversion, but only for bytecode (so radix/base 256). Here's only the BigInt part, for regular Integers you could change it a bit, or you use the 'power' of Typed Arrays (which I don't like that much..).
You could use it for more efficient encoding of numbers, on disk or via network transmission, etc.
- Version v3.3.0 (updated 2025-05-31)
My solution for JavaScript's instanceof
problem, so when in multiple environments
the classes are initialized/declared not once. In this case, comparing two environments,
it's like Array !== Array
, e.g.. and I don't mean only the instances, the base classes
are being created multiple times in multiple environments..
So I'm using [Reflect.]is()
and [Reflect.]was()
(for a long time, so it's well tested,
and works great). You'll find more description in this reflection
.js, in
the starting comment on top of the file.
- Version v0.2.2 (created 2024-07-07)
Intersection for Arrays. Works with any data type (so no optimization like binary search possible here), and respects multiple occurences (if no (true) is in your arguments).
Depends on my multiset
.js!!
- Version v0.2.0 (created 2024-04-30)
My MultiSet
class: extends Map
, but works like a Set
, with the difference
that it also counts the amount of items in this set.
String extensions to support C {un,}escaping.
Example given \n
is the newline character.
- Version v0.2.0 (created 2024-11-26)
Supports both escaping and unescaping. The latter will
produce strings with the encoded values, so \n
will
become a real newline byte, and the first one will
encode the string \n
out of the \10
byte code.
Tip
Count and/or convert your text files with this little tool
(instead of the old dos2unix
etc.)!
- Version v0.1.0 (created 2025-01-14)
Counts any occurence of various (UNIX, DOS, MAC) newlines if called without additional parameters; as follows:
-d / --dos
-u / --unix
-m / --mac
- [
-c / --count
]
They define the optional target format to which the input will be converted to. Optional, and only one of them per call (last occurence rules).
If stdin
is being filled, no additional file path parameter
will be used. Or define any amount of file paths - they get
used in order. The -
file is also allowed (also stdin
).
Files that don't exist or files with open/read errors will always throw an exception.
stdout
is the place where either the count result will be,
or with enabled conversion stdout
is the place for the new
data - stderr
in this case for the count summary at the end.
- Version v0.2.1 (updated 2024-11-05)
Two functions to measure the throughput of your data, in bytes per second (just
remove the multiplication with 1000 für milliseconds); and the ETA ('Estimated
Time Of Arrival') w/ .remaining()
, in milliseconds (multiply *1000 for seconds).
Helper to handle file modes, usually integers in the fs.Stats
in the Node.js. But surely can also be used in general for linux filesystem modes, etc.
A really old implementation, used that times in my < libjs.de > ... ... now with better "file type" integration, and last improvements.
- Version v0.4.2 (updated 2025-05-23)
It brings Linux file system (mode/permission) feelings.
This is just a link to the only animation
.js of my
v4 project.
Some extensions to the Web Animations API; very necessary for my special needs.. it's also the one with the most lines.
Maybe useful for you? But you've to read the source for yourself; and some functions may be missing; then look at my v4 source code!
Extends the Date
object with moon phase calculation functions.
- Version v0.2.3 (created 2024-08-04)
[!WARN] MAYBE old version?? For more, partially very useful
Date
extensions take a look (for docs and concrete code):
I'm a bit embarrassed about this script - it's just so really tiny and nothing..
- Version v0.1.1 (updated 2024-12-13)
But I really needed it one time. Read the description in the comment on top of this file.
Little 'toy'! "Maps" some counted values in a coordinate system, so it draws kinda chess board .. in your console/terminal! ;-)
- Version v0.2.1 (uploaded 2024-12-24);
DEPENDS on my own library, so you've to adapt this script for your own!
- Version v0.2.0 (updated 2024-06-03)
It's merely kinda proof of concept that state parsers can be as good as regular expressions, or even better! ;-D See also this discussion;
- Version v0.1.0 (updated 2024-03-04)
'Folds' CSS style code. Earlier I used the fold
(Linux) command, but that didn't work that well for what
I needed the resulting code: had to filter out CSS classes in .html
code and grep
for them in many
.css
files - since grep
is for lines, and cut
is too stupid, .. I couldn't find the CSS styles in
stylesheets without newlines, etc. ..
The reason for this script was: I wanted to 'import' GitHub's markdown .css
code, since my website
provides all my GitHub repositories, and I needed only some parts out of there..
but the code is/was a mess!
Important
Early version, so only the real basics are covered.
This one has it's own repository.
The Copyright is (c) Sebastian Kucharczyk, and it's licensed under the MIT (also known as 'X' or 'X11' license).
