17.7.7 • Published 3 years ago

xlib v17.7.7

Weekly downloads
319
License
Apache-2.0
Repository
github
Last release
3 years ago

Best used with Typescript 3.x


Abstract

xlib is a monolitic core/utilities library. It's designed to be a one-stop-shop for professional developers who need functionality that will work across Browser or Server.

expected setup

While you can use npm install xlib to use this in just about any javascript project or environment, here are what we test with:

  • vscode v.latest
  • ts v3.x
  • node v8.x

You can check out the PhantomJsCloud NPM library for a real-life usage example.


Usage

xlib is transpiled to es5 compatable javascript using commonjs module format. Thus you can consume it as you would any other NPM module:

//typescript 3.0 /es6 example:

import * as xlib from "xlib";
//override environment variables we otherwise read from the node.commandline, system.env, or browser.querystring


//log something
let log = new xlib.logging.Logger(__filename);
log.info("hi",{some:"data"});

Functionality

see the generated api docs here. though the doc generator (TypeDoc) is severely lacking, so best to use the intelisence of your favorite code editor.

The main functional areas xlib covers

  • Cache (collection with expiring values)
  • Collection (utilities for collections)
  • DateTime (moment and moment utils)
  • Environment (cross-platform environment variables and platform detection)
  • Exception (improved exception base class)
  • Logging (robust, configurable logging)
  • Net (axios and http utils)
  • Promise (bluebird and bluebird helpers)
  • Reflection (hight quality runtime type detection and utils)
  • Security (crypto utils)
  • Serialization (robust and user friendly JSON (de)serialization)
  • Threading (read/write lock)
  • Validation (user input scrubbing)
  • Utility (lodash, jsHelpers, Array/Number/String utils)

Logging

let log = new xlib.logging.Logger(__filename);
log.info("hi",{some:"data"});

a robust and configurable logger, with log-levels set via global environment variables.

limitations: only logs to console for now. A configurable listener would be preferable, if you want to send a pull request!

Environmental/Startup Options

by default, when you import xlib it will initialize it's xlib.environment variables with default values, and verbosely log its self-setting of defaults:

  • logLevel defaults to TRACE
  • envLevel defaults to PREPROD
  • isTest defaults to FALSE
  • isDev defaults to FALSE

if you don't want to set environmental or startup options, you can instead set a global._xlibConfigDefaults object. This also silences the verbose console output.

here's an example of how you can use it:

//specify xlib config options, without requiring environmental config
(global as any)._xlibConfigDefaults = {
	logLevel: "ERROR",
	envLevel: "PROD",
	isTest: "FALSE",
	isDev: "FALSE",
	sourceMapSupport: true,
} as typeof _xlibConfigDefaults;
import xlib = require("xlib");

Versioning / Upgrading

xlib follows Semver versioning. Thus any breaking change will be released under a major version, and new functionality will be released under minor versions.

v10.x restructure

the 10.x branch (and semver) is a restructure of this project to take advantage of the now fully mature typescript ecosystem. Prior to 10.x, to publish a typescript project was a tedious process.

future work

xlib's core functionality has been used in production code since 2015. While mostly stable since, a major refactor is expected to occur in the Dec 2018 timeframe, to better take advantage of improvements in typescript and javascript ecosystems.


Why

Since I started programming, I've a big fan of the .NET Framework. Xlib is my attempt to bring that level of great features + (re)usability to the Typescript.

18.0.0-dev.11

3 years ago

18.0.0-dev.10

3 years ago

18.0.0-dev.2

3 years ago

18.0.0-dev.3

3 years ago

17.7.7

3 years ago

17.7.6

5 years ago

17.7.5

5 years ago

17.7.4

5 years ago

17.7.3

5 years ago

17.7.1

5 years ago

17.7.0

5 years ago

17.6.0

5 years ago

17.5.2

5 years ago

17.5.1

5 years ago

17.5.0

5 years ago

17.4.0

5 years ago

17.3.1

5 years ago

17.3.0

5 years ago

17.2.0

5 years ago

17.1.1

5 years ago

17.1.0

5 years ago

17.0.5

5 years ago

17.0.4

5 years ago

17.0.3

5 years ago

17.0.2

5 years ago

17.0.1

5 years ago

17.0.0

5 years ago

16.5.0

5 years ago

16.4.1

5 years ago

16.3.0

5 years ago

16.4.0

5 years ago

16.2.0

5 years ago

16.1.3

5 years ago

16.1.2

5 years ago

16.1.1

5 years ago

16.1.0

5 years ago

16.0.0

5 years ago

15.1.3

5 years ago

15.1.2

5 years ago

15.1.1

5 years ago

15.1.0

5 years ago

15.0.1

5 years ago

15.0.0

5 years ago

14.3.2

5 years ago

14.3.1

5 years ago

14.3.0

6 years ago

14.2.0

6 years ago

14.1.3

6 years ago

14.1.2

6 years ago

14.1.1

6 years ago

14.1.0

6 years ago

14.0.3

6 years ago

14.0.2

6 years ago

14.0.1

6 years ago

14.0.0

6 years ago

13.6.3

6 years ago

13.6.2

6 years ago

13.6.1

6 years ago

13.6.0

6 years ago

13.5.0

6 years ago

13.4.1

6 years ago

13.4.0

6 years ago

13.3.0

6 years ago

13.2.0

6 years ago

13.1.0

6 years ago

13.0.2

6 years ago

13.0.1

6 years ago

13.0.0

6 years ago

12.1.0

6 years ago

12.0.1

6 years ago

12.0.0

6 years ago

11.0.1

6 years ago

11.0.0

6 years ago

10.3.0

6 years ago

10.2.0

6 years ago

10.1.0

6 years ago

10.0.4

6 years ago

10.0.3

6 years ago

10.0.2

6 years ago

10.0.1

6 years ago

9.0.1

7 years ago

9.0.0

7 years ago

8.5.0

7 years ago

8.4.2

7 years ago

8.4.1

7 years ago

8.4.0

7 years ago

8.3.0

7 years ago

8.2.1

7 years ago

8.2.0

7 years ago

8.1.0

7 years ago

8.0.4

7 years ago

8.0.3

7 years ago

8.0.2

7 years ago

8.0.1

7 years ago

8.0.0

7 years ago

7.4.0

7 years ago

7.3.0

7 years ago

7.2.0

7 years ago

7.1.0

7 years ago

7.0.0

7 years ago

6.2.0

7 years ago

6.1.0

8 years ago

6.0.2

8 years ago

6.0.1

8 years ago

6.0.0

8 years ago

5.3.1

8 years ago

5.3.0

8 years ago

5.2.1

8 years ago

5.2.0

8 years ago

5.1.1

8 years ago

5.1.0

8 years ago

5.0.11

8 years ago

5.0.10

8 years ago

5.0.9

8 years ago

5.0.8

8 years ago

5.0.7

8 years ago

5.0.6

8 years ago

5.0.5

8 years ago

5.0.4

8 years ago

5.0.3

8 years ago

5.0.2

8 years ago

5.0.1

8 years ago

5.0.0

8 years ago

4.2.1

8 years ago

4.2.0

8 years ago

4.1.1

8 years ago

4.1.0

8 years ago

4.0.23

8 years ago

4.0.22

8 years ago

4.0.21

8 years ago

4.0.20

8 years ago

4.0.19

8 years ago

4.0.18

8 years ago

4.0.17

8 years ago

4.0.16

8 years ago

4.0.15

8 years ago

4.0.14

8 years ago

4.0.13

8 years ago

4.0.12

8 years ago

4.0.11

8 years ago

4.0.10

8 years ago

4.0.9

8 years ago

4.0.8

8 years ago

4.0.7

8 years ago

4.0.6

8 years ago

4.0.5

8 years ago

4.0.4

8 years ago

4.0.3

8 years ago

4.0.2

8 years ago

4.0.1

8 years ago

4.0.0

8 years ago

0.0.12

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago