# @ksfcore/dyeing

> KSF 染色基础模块

Latest version **2.0.1** (published 2023-02-06) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install @ksfcore/dyeing
pnpm add @ksfcore/dyeing
yarn add @ksfcore/dyeing
bun add @ksfcore/dyeing
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2023-02-06 |
| First published | 2023-02-06 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | yinuu, juli.xiong |
| Keywords | dyeing, ksf |

## Links

- npm: https://www.npmjs.com/package/@ksfcore/dyeing
- npm.io page: https://npm.io/package/@ksfcore/dyeing

## Recent versions

- 2.0.1 (latest) — 2023-02-06

## README

# @ ksf / dyeing

The KSF dyeing basic module provides methods for obtaining and judging `staining objects`.

__Users: You should not use this module directly, but use other modules that meet the `staining standards` to obtain` staining objects`__

__Module developer: Get `KSF stained objects` You should use this module's `gen()` method to get` colored objects`__

## Dyeing (Introduction)

Coloring is a state passed on the interface's invocation chain (server <==> client) to identify a specific request processing process.

This state consists of a flag and additional information `KEY` _ (optional) _.

Services on the call chain can set (originate) and read (receive) this state, and perform corresponding processing (such as outputting specific logs and characteristics).

In the system, dyeing consists of this module and its corresponding convention.

## Standard (Convention)

If the module uses a dyeing system, it is necessary to comply with the following conventions (At the same time, we will refer to the modules that meet the conventions as the modules that meet the `staining standards`):

1. Provide the `getDyeingObj()` method and return `Dyeing Object`.
2. Use the @ ksf/dyeing.gen method to generate a dyeing object.
3. Use the @ ksf/dyeing.is() method to determine whether the dyeing object is valid.

## Module method

### KsfDyeing.gen (dyeing [, key, args])

By calling this method, you can get `colored objects`:

__dyeing__: Do you need dyeing
__key__: Coloring additional information `KEY` (optional)
__args__: additional parameters of the program (optional)

`key` is passed to the next service through the call chain, while `args` is only valid in the current dyed object (it is not passed).

__Please note: The cause of the staining is different from the cause of the staining (thing). This module only cares about the stained objects, not the cause of the staining.__

### KsfDyeing.is(obj)

Call this method to determine whether an object passed in is a `colored object`:

If an empty object is passed in, the method will also return `false`

## Dyeing Object Properties

### dyeingObj.dyeing

Whether coloring is required, this is `Boolean`

### dyeingObj.key

Additional information passed by the dye, this is `String` and is optional and may not exist

### dyeingObj.args

Additional information about the dyed object itself, which should not be passed between services by business code (only used as a local parameter).

This object is not limited in type and is also optional

---
_Source: https://npm.io/package/@ksfcore/dyeing · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
