open-index/open-npm huggingface dataset:
npm package: @gxyz/data.formats
Description: @gxyz/data.formats is a collection of data logging formats for use with Winston
Author: Aziz Da
Latest version: 0.1.0

# @gxyz/data.formats

**@gxyz/data.formats** is a collection of data logging formats for use with [Winston](https://github.com/winstonjs/winston).

## Installation

Install the module locally via your favorite npm client, like **npm**:

```shell
npm install @gxyz/data.formats
```

or **yarn**:

```shell
yarn add @gxyz/data.formats
```

## Usage

### mustache

Use [Mustache.js](https://github.com/janl/mustache.js "Mustache.js") as template system to format logs’s display.

You can use this format from the main entrance:

```js
const {mustache,} = require('@gxyz/data.formats');
```

Or from the custom sub-path `./mustache`:

```js
const mustache = require('@gxyz/data.formats/mustache');
```

Using this path **is not recommended**:

```js
const mustache = require('@gxyz/data.formats/lib/mustache');
```

```js
const mustache = require('@gxyz/logger.format.mustache');

const logger = winston.createLogger({
  format: mustache({
    source: require.resolve('./tpl.mustache'),
  }),
});
```

mustache format accepts the following config props:
+ `source` prop of type String that points to Mustache filename or Mustache template. Please consider using [`require.resolve`](https://nodejs.org/api/modules.html#modules_require_resolve_request_options "require.resolve(request[, options])") to point to a filename.
+ All remaining props of config will be considered part of view obj ([take a look at Mustache.js docs](https://github.com/janl/mustache.js/#readme "Mustache.js")).

## Credits

| [![Aziz Da](https://github.com/azizdawhat.png?size=100 "Aziz Da")](https://github.com/azizdawhat "Aziz Da on GitHub") |
|:---:|
| [Aziz Da](https://github.com/azizdawhat "Aziz Da") |

## License

[Unlicense](UNLICENSE "Unlicense")
npm package: @gxyz/data.logger
Description: @gxyz/data.logger is a Winston Data logger storing data in Console
Author: Aziz Da
Latest version: 0.1.0

# @gxyz/data.logger

**@gxyz/data.logger** is a [Winston](https://github.com/winstonjs/winston) Data logger storing data in Console.

## Installation

Install the module locally via your favorite npm client, like **npm**:

```shell
npm install @gxyz/data.logger
```

or **yarn**:

```shell
yarn add @gxyz/data.logger
```

## Usage

Take a look at [Winston docs](https://github.com/winstonjs/winston#readme "winston").

```js
const logger = require('@gxyz/data.logger');
```

#### Examples

```js
logger.error({
  message: new Error('Oops!... I Did It Again'),
  name: 'Britney Spears',
});
```

```js
logger.log({
  level: 'info',
  message: 'Hello, World!',
  name: 'GalaXYZ',
});
```

### Transports

[You may also dynamically change the log level of a transport.](https://github.com/winstonjs/winston#using-logging-levels "winston#Using Logging Levels")

Using custom transports subpath `./transports`:

```js
const transports = require('@gxyz/data.logger/transports');
```

Using this path **is not recommended**:

```js
const transports = require('@gxyz/data.logger/lib/transports');
```

#### transports.consoleStore

consoleStore is the only store available.

```js
const {consoleStore,} = transports;

consoleStore.level = 'verbose';
```

## Credits

| [![Aziz Da](https://github.com/azizdawhat.png?size=100 "Aziz Da")](https://github.com/azizdawhat "Aziz Da on GitHub") |
|:---:|
| [Aziz Da](https://github.com/azizdawhat "Aziz Da") |

## License

[Unlicense](UNLICENSE "Unlicense")
npm package: @gxyz/logger
Description: @gxyz/logger is no longer maintained, is deprecated in favor of @gxyz/data.logger
Author: Aziz Da
Latest version: 0.1.3
Deprecated: @gxyz/logger is no longer maintained, is deprecated in favor of @gxyz/data.logger

# @gxyz/logger

**@gxyz/logger** is no longer maintained, is deprecated in favor of **[@gxyz/data.logger](https://www.npmjs.com/package/%40gxyz%2Fdata.logger)**.

## Credits

| [![Aziz Da](https://github.com/azizdawhat.png?size=100 "Aziz Da")](https://github.com/azizdawhat "Aziz Da on GitHub") |
|:---:|
| [Aziz Da](https://github.com/azizdawhat "Aziz Da") |

## License

[Unlicense](UNLICENSE "Unlicense")
npm package: @gxyz/logger-formats
Description: @gxyz/logger-formats is a collection of formats for Winston logger
Author: Aziz Da
Latest version: 0.1.3
Deprecated: @gxyz/logger-formats is deprecated in favor of @gxyz/logger.format.mustache. No longer maintained.

# @gxyz/logger-formats

## No longer maintained

**@gxyz/logger-formats** is deprecated in favor of **@gxyz/logger.format.mustache**.

## Credits

| [![Aziz Da](https://github.com/azizdawhat.png?size=100 "Aziz Da")](https://github.com/azizdawhat "Aziz Da on GitHub") |
|:---:|
| [Aziz Da](https://github.com/azizdawhat "Aziz Da") |

## License

[Unlicense](UNLICENSE "Unlicense")
npm package: @gxyz/logger.format.mustache
Description: @gxyz/logger.format.mustache is no longer maintained, is deprecated in favor of @gxyz/data.formats
Author: Aziz Da
Latest version: 0.1.1
Deprecated: @gxyz/logger.format.mustache is no longer maintained, is deprecated in favor of @gxyz/data.formats

# @gxyz/logger.format.mustache

**@gxyz/logger.format.mustache** is no longer maintained, is deprecated in favor of **[@gxyz/data.formats](https://www.npmjs.com/package/@gxyz/data.formats)**.

## Credits

| [![Aziz Da](https://github.com/azizdawhat.png?size=100 "Aziz Da")](https://github.com/azizdawhat "Aziz Da on GitHub") |
|:---:|
| [Aziz Da](https://github.com/azizdawhat "Aziz Da") |

## License

[Unlicense](UNLICENSE "Unlicense")
npm package: @gxyz/util-promises
Description: @gxyz/util-promises is a lightweight util library to ease the use of promises and async funcs
Author: Aziz Da
Latest version: 0.1.3
Deprecated: 0.1.3

# @gxyz/util-promises

## No longer maintained

**@gxyz/util-promises** is deprecated in favor of **@gxyz/util.func/promises**.

## Credits

| [![Aziz Da](https://github.com/azizdawhat.png?size=100 "Aziz Da")](https://github.com/azizdawhat "Aziz Da on GitHub") |
|:---:|
| [Aziz Da](https://github.com/azizdawhat "Aziz Da") |

## License

[Unlicense](UNLICENSE "Unlicense")
npm package: @gxyz/util.func
Description: @gxyz/util.func is a lightweight utility library for easy use of (returns) functions
Author: Aziz Da
Latest version: 0.1.1

# @gxyz/util.func

**@gxyz/util.func** is a lightweight utility library for easy use of (returns) functions.

## Installation

Install the module locally via your favorite npm client, like **npm**:

```shell
npm install @gxyz/util.func
```

or **yarn**:

```shell
yarn add @gxyz/util.func
```

## Usage

```js
const {compose, tryCatch,} = require('@gxyz/util.func');
```

#### compose(…functions)

> Compose async funcs.
> Take a look at the [MDN Web Docs - Using Promises - Composition](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#Composition "MDN Web Docs - Using Promises - Composition").

Compose takes an arguments object of async funcs or promises or an array of async funcs or promises.

Compose returns a function, arguments object passed to this function will be used as arguments object of the first element of `…functions`.

Compose returned func returns an object as promise:
+ If all `…functions` are fulfilled, returned obj will have a `value` prop with the reduced value.
+ If any of `…functions` is rejected, returned obj will have a `reason` prop with err.

```js
async function dealAsyncFuncs(...args) {
  const {reason, value,} = await compose(func0, func1, func2)(...args);

  if (reason instanceof Error) {
    throw reason;
  }

  return value;
}
```

#### tryCatch(func)

> Better manage errors within async funcs.

tryCatch takes an async func or a promise as arg.

tryCatch returns a function, arguments object passed to this function will be used as argument object to `func`.

tryCatch returned func returns an object as promise:
+ If `func` is fulfilled, returned obj will have a `value` prop with returned value.
+ If `func` is rejected, returned obj will have a `reason` prop with err.

```js
async function dealAsyncFunc(...args) {
  const {reason, value,} = await tryCatch(func)(...args);

  if (reason instanceof Error) {
    throw reason;
  }

  return value;
}
```

## Credits

| [![Aziz Da](https://github.com/azizdawhat.png?size=100 "Aziz Da")](https://github.com/azizdawhat "Aziz Da on GitHub") |
|:---:|
| [Aziz Da](https://github.com/azizdawhat "Aziz Da") |

## License

[Unlicense](UNLICENSE "Unlicense")