npm package: @kekse.biz/lib.js
Description: library extensions and global environment
Author: Sebastian Kucharczyk
Latest version: 1.8.1

# kekse.biz

## lib.js

"Node.js" Library Extensions.

To be continued. ...

### Installation

#### npm Module

	`npm install @kekse.biz/lib.js --save`
	require('@kekse.biz/lib.js');

#### Setup script (global or local installation)

This gives you ultimate features in/for your scripts (the easy way ;-),
e.g. the direct interpreter call, so you never need to "require()" this
library every time.

I'm preparing a special installation script "setup.sh". .. more l8rs...

	Syntax: ./setup.sh
        	[ --global  / --local ]
		[ --no-update ]
        	[ --no-dhparam ]
        	[ --no-copy ]
        	[ --no-link ]
		[ --no-env ]
		[ --no-config ]
	        [ -? / --help ]

Is not yet done. ... TODO!

#### Local setup

The same script "setup.sh" but with parameter "--local" or "-l".

	./setup.sh --local

Is not yet done. ..

### Configuration

#### Environment variables

There are some (optional) environment variables to change the behaviour
of some things. I'm gonna explain them later. And for now you could see
all the "settings.env" variables in "lib.settings.js". :-) ...

#### Settings file

See "lib.settings.js".

### Features

#### Localization

The base already exists. But there are some phrases still TODO for this
library. In your own apps you can use my localization unit, too. .. for
this you'll have to create a special (configurable) directory, with sub
directories for each language.

The language should change by default, as 'process.lang' also chooses it
by looking at the first two characters of the (nearly always existing)
environment variable "LANG" (but 'lib.js' may look to "LANGUAGE" first)!

This feature uses some kind of "inheritance": if you want to output some
error message that fits to "path not found" (e.g.), you'd to write this:

	dict('error.path'); // dict(_phrase, _map, _stream, _exit);

This phrase should be found, as it's integrated in my "TextDB" of lib.js.

BUT if you're using your own phrases and such error phrase wouldn't have
been found, the system would automatically try all the "higher levels" of
such *hierarchical* keys. So, if "error.path.notfound" doesn't exist, the
next try is "error.path". If this wasn't found, last try (before trying
another language.. ;-) would be "error" - so the user will at least know
that an error happened, even if he doesn't exactly know the reason.

#### getopt

See "library/util/getopt.js". I think I gave my best to make it useful and
logical. It's not like the "official" (UNIX) getopt - but better IMO.. HF! :-D

#### load()

See "library/lib.js". It's my better "require()" to load modules in the real
library/ path(s). You could also structure other modules w/ "$module/main.js",
which is checked first. After this it'd check "$module.js".

As in previous versions I will implement to search in other paths and "/home";
but this is not ready yet(!). TODO. Also a cache is planned - at the moment it
just works with original Node.js modules, not those in my library. ..TODO! ;-)

#### (TODO)

...

### Binaries

See "package.json" (there are the resolved paths, in the main directory im using symlinks).

	# version.js
	# node.js
	# shell.js
	# mud.js
	# radio.js
	# api.js
	# setup.sh

#### "version.js"

This is a short test, if there's a new Node.js version available. If you see a happy smiley,
everything is O.K.! ;-)´

#### "node.js"

This is the "interpreter". You can use it in any of your JavaScripts (assuming you've already
installed the "lib.js" globally - look at "Installation -> Global" in this README.md file..):

	#!/usr/bin/env node.js

You can also call it via "./node.js script.js" - so you don't have to "require()" this whole
library. "Everything" (the inclusion of "library/lib.js" ;-) is done automatically. So you'll
be able to use the common JavaScript global objects (see "global/*.js"), e.g. :-)

#### "shell.js"

TODO.

#### "mud.js"

TODO.

#### "radio.js"

TODO (Quantum neural network computation).

#### "api.js"

TODO. This will be used for automatic API documentation generation!

To stay conform to my regular style to do this, just look at my "define()" in "library/lib.js".
It's my "better" replacement for "Object.defineProperty()", directly under "Object.prototype..".

#### "setup.sh"

To learn more about this topic, take a look at "Installation -> Global/Local setup".

### "Git" repository

Look at <https://git.kekse.biz/>. ...

### License

MIT License

Copyright (c) 2018 Sebastian Kucharczyk

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.