open-index/open-npm huggingface dataset:
npm package: @kwzm/replace-loader
Description: A text replacement loader for webpack.
Author: kwzm
Latest version: 2.1.0

# replace-loader
A loader to replace text in webpack, since the internal implementation is based on the [string.prototype.replace](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) implementation, the methods used are basically the same.
## Install
`npm i @kwzm/replace-loader`
## Usage
```
{
  loader: '@kwzm/replace-loader',
    options: {
      replace: [
        { from: 'old text', to: 'new text' },
        { from: /old text/gi, to: 'new text'}
      ]
    }
}
```
## Licence
[MIT](http://en.wikipedia.org/wiki/MIT_License)
npm package: @kx501/koishi-plugin-electric-fee
Description: 简单统计宿舍电费
Latest version: 1.0.3

# koishi-plugin-tariff

[![npm](https://img.shields.io/npm/v/koishi-plugin-tariff?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-tariff)

简单寝室电费统计
npm package: @kx501/koishi-plugin-multi-quiz
Description: api答题，包括：诗词、成语、谜语、字谜、灯谜、脑筋急转弯、广告......，
Latest version: 1.0.6-alpha1

# @kx501/koishi-plugin-multi-quiz

[![npm](https://img.shields.io/npm/v/@kx501/koishi-plugin-multi-quiz?style=flat-square)](https://www.npmjs.com/package/@kx501/koishi-plugin-multi-quiz)

多类型答题插件
npm package: @kx501/koishi-plugin-pollinations-draw
Description: PollinationsAI Draw 的简单实现
Latest version: 1.0.6

# @kx501/koishi-plugin-pollinations-draw

[![npm](https://img.shields.io/npm/v/@kx501/koishi-plugin-pollinations-draw?style=flat-square)](https://www.npmjs.com/package/@kx501/koishi-plugin-pollinations-draw)

使用PollinationsAI平台的API画画
npm package: @kx501/koishi-plugin-red-packet
Description: 来抢个手气红包吧
Latest version: 1.1.1

# @kx501/koishi-plugin-red-packet

[![npm](https://img.shields.io/npm/v/@kx501/koishi-plugin-red-packet?style=flat-square)](https://www.npmjs.com/package/@kx501/koishi-plugin-red-packet)

来抢个手气红包吧
npm package: @kx501/koishi-plugin-sd-painter
Description: 简单对接 SD WebUI 实现部分功能
Latest version: 1.0.4-beta.1

# @kx501/koishi-plugin-sd-painter

[![npm](https://img.shields.io/npm/v/@kx501/koishi-plugin-sd-painter?style=flat-square)](https://www.npmjs.com/package/@kx501/koishi-plugin-sd-painter)

## 说明

简单对接 Stable Diffusion WebUI（理论支持 Forge）与 Koishi，参考：[novelai-bot](https://github.com/koishijs/novelai-bot)

### 🌟 插件功能

* **文/图生图**
* **中止生成**
* **HiresFix 部分功能**
* **WD1.4 Tagger 部分功能**
* **ADetailer 部分功能**
* **查询/切换模型(未测试)**
* **修改配置(未测试)**
* **图片审核(测试版)，见：**[imgCensor](https://github.com/Kx501/koishi-plugin-imgcensor)

### ⚠️ 注意事项

1. 子指令只能直接调用
2. 默认使用的是秋葉整合包
3. 翻译服务只测试了 [百度翻译](https://api.fanyi.baidu.com/api/trans/product/desktop)
4. dvc 只测试了 [DeepSeek](https://github.com/Kx501/koishi-plugin-imgcensor) 效果不错
5. 默认指令较多，建议在指令管理中个性化配置

## English Version

Simple integration of Stable Diffusion WebUI with Koishi, reference: [novelai-bot](https://github.com/koishijs/novelai-bot).

### 🌟 Features

* **Text/Image-to-Image Generation**
* **interrupt generation**
* **HiresFix Partial Features**
* **WD1.4 Tagger Partial Features**
* **ADetailer Partial Features**
* **Model Query/Switching** (Experimental)
* **Configuration Editing** (Experimental)
* **Image Censorship (Beta)**: See [imgCensor](https://github.com/Kx501/koishi-plugin-imgcensor)

### ⚠️ Important Notes

1. Sub-commands can only be invoked directly.
2. The default setup uses the 秋葉 integration package.
3. Translation services are only tested with [Baidu Translate](https://api.fanyi.baidu.com/api/trans/product/desktop).
4. dvc has only been tested with [DeepSeek](https://github.com/Kx501/koishi-plugin-imgcensor), which works well.
5. There are many default commands, it's recommended to customize them in the command manager.
npm package: @kx501/koishi-plugin-signin
Description: 签到，连续奖励，分时间段自定义提示语。
Latest version: 1.0.0

# @kx501/koishi-plugin-signin

[![npm](https://img.shields.io/npm/v/@kx501/koishi-plugin-signin?style=flat-square)](https://www.npmjs.com/package/@kx501/koishi-plugin-signin)

Koishi 签到插件，连续签到，自定义提示语和概率，支持 bind

**To Do:**

- 分时间段自定义一言
npm package: @kxgo/easy-mock
Description: easy mock data with easy config, support customize middleware
Author: fujuewen
Latest version: 0.1.4

# @kxgo/easy-mock

`easy-mock`只需一些简单的配置就可以轻松`mock`数据

### 安装
--------
```
npm i @kxgo/easy-mock
or
yarn add @kxgo/easy-mock
```

### 使用
--------
``` javascript
const path = require('path')
const easyMock = require('@kxgo/easy-mock')

new easyMock({
  // 请传递完整的配置文件路径进去，服务是会自动刷新
  path: path.resolve(__dirname, 'xxxx.js')
})
```
`配置文件的例子`
``` javascript
// xxxx.js
module.exports = {
  // common选项不是必须, 内置的配置如下，当然你也可以更改
  common: {
    // mock服务的默认端口，如果端口被占用，会换一个
    port: 8018,
    // 如果你想看一下ajax的loading效果，该配置项可以设置接口的返回延迟
    timeout: 500,
    // 如果你想看一下接口请求失败的效果，将rate设置成0就可以了，rate取值范围0~1，代表成功的概率
    rate: 1,
    // mock属性为false的话可以关闭掉mock服务
    mock: true,
    // 是否打印调试信息
    debug: false
  },
  // api...，可以不用写全，写最后一个就好
  'getList': {
    code: 0,
    'data|5': [{
      'uid|1000-99999': 999,
      'name': '@cname'
    }],
    result: true
  },
  '/pkApi/getPerson': {
    code: 0,
    'data|5': [{
      'name': '@cname'
    }],
    result: true
  },
  '/pkApi/getOther': {
    code: 0,
    'data|5': [{
      'name': '@cname'
    }],
    result: true
  }
}
```
服务启动后，打开`http://127.0.0.1:8018/pkApi/getPerson`就可以看到mock的数据了！

### 本地debug
```
npm i kxg -g
npm i nodemon -g

npm run dev
```

### 发布
```
npm i standard-version -g
npm run pub
```

### Q&A
--------
##### 1 怎么去mock jsonp
在链接后面传`callback`参数就好了
##### 2 怎么去mock数据
参考[mock rule](http://mockjs.com/examples.html)
##### 3 怎么去处理更复杂的场景，我想要自定义数据返回
``` javascript
module.exports = {
  ...
  ['/pkApi/getOther'] (req, res) {
    const query = req.query
    // 可以自己写处理逻辑
    return {}
  }
  ...
}
```
`get`类型的请求可以通过`req.query`去获取参数

`post`类型的请求可以通过`req.body`去获取参数

### issues
-----------
[issue list](https://github.com/kxgo/easy-mock/issues)

### changelog

[changelog](./CHANGELOG.md)
npm package: @kxtxr/ts-guard
Description: @kxtxr/ts-guard is a TypeScript utility package that provides a set of commonly used guard functions.
Latest version: 1.0.2

# @kxtxr/ts-guard

@kxtxr/ts-guard is a TypeScript utility package that provides a set of commonly used guard functions.

## Installation
Install @kxtxr/ts-guard via npm:
```shell
npm install @kxtxr/ts-guard
```

## Usage
Here is how you can use some of the guard functions:

```typescript
import { isPresent, isNumber } from '@kxtxr/ts-guard';

const x: number | undefined | number | string = foo.bar;

if (isNumber(x)) {
  // x is number
}

if (isPresent(x)) {
  // x is number or string
}
```