open-index/open-npm huggingface dataset:
npm package: @nicecode/mofish
Description: 根据 YApi 的接口定义生成 TypeScript/JavaScript 的接口类型及其请求函数代码。
Author: dev
Latest version: 3.38.0


# 接口代码自动生成

`mofish` 是一个代码生成工具，其可根据 [YApi](https://github.com/YMFE/yapi) 或 [Swagger](https://swagger.io/) 的接口定义生成 TypeScript 或 JavaScript 的接口类型及其请求函数代码。

## 特性

- 支持多服务器、多项目、多分类
- 支持预处理接口信息
- 可自定义类型或函数名称
- 完整的注释
- 支持生成 React Hooks 的请求代码
- 支持参数路径
- 支持上传文件
- 支持生成 JavaScript 代码
- 支持 Swagger

## 环境要求

首先得有 [Node.js](https://nodejs.org/en/)，并确保其版本 `>= 10.19.0`。同时：

- 对于基于 YApi 的项目，要求 YApi 的版本必须 `>= 1.5.12`。
- 对于基于 Swagger 的项目，仅支持 `Swagger 2` 和 `OpenAPI 3`。

## 安装

选择你常用的包管理器将 `@nicecode/mofish` 加入项目依赖即可：

```bash
# npm
npm i @nicecode/mofish

# yarn
yarn add @nicecode/mofish

# pnpm
pnpm add @nicecode/mofish
```


## 使用

注意在swagger模式下无法分离api文件和按需引入接口，每个项目都在一个接口文件中，yapi模式可以通过 ID 筛选分类

### 生成配置文件

```bash
npx mofish init
```


```js
// mofish.config.ts
import { defineConfig } from '@nicecode/mofish'

export default defineConfig([
  {
    serverUrl: 'http://localhost:3000', // 接口服务地址，支持swagger
    typesOnly: false,
    target: 'typescript',
    reactHooks: {
      enabled: false,
    },
    devEnvName: 'dev',
    prodEnvName: 'prod',
    outputFilePath: interfaceInfo => `api/${interfaceInfo._category.name}.ts`,   // 接口输出文件路径
    requestFunctionFilePath: 'utils/request.ts',   // 请求函数路径
    dataKey: 'data',
    comment: {
      category: false,
      tag: false,
      requestHeader: false
    },
    projects: [ // 项目列表，对应单个项目swagger文档链接
      {
        token: 'ce517e50453e14f9b00039538235720a23337590f107455eaa6fb65a6bda7f22',  // yapi token,在对应项目中获取，swagger模式下可不传
        categories: [
          {
            id: [272, 308, 425],   // 接口分类id，对应yapi链接：/api/cat_${id}  0为全部
            getRequestFunctionName(interfaceInfo, changeCase) {
              // 以接口全路径生成请求函数名
              return changeCase.camelCase(interfaceInfo.path)
            },
          },
        ],
      },
    ],
  },
])
```


### 生成代码

使用以下命令生成代码：

```bash
npx mofish
```

如果要使用自定义的配置文件：

```bash
npx mofish -c config/mofish.ts
```
npm package: @nicecode/player
Description: nicecode视频播放器
Author: nicecoder
Latest version: 0.3.0

### 安装相关依赖

```js
npm install @nicecode/vplayer --save
```

### 使用效果

#### 视频播放器

```jsx
import React, { useEffect, useRef } from 'react';
import { Vplayer } from '@nicecode/player';

export default () => {
  const vRef = useRef(null);

  useEffect(() => {}, []);

  return (
    <Vplayer
      ref={vRef}
      config={{
        poster:
          '//lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/byted-player-videos/1.0.0/poster.jpg',
        url: '//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-360p.mp4',
      }}
    />
  );
};
```

#### 音乐播放器

```jsx
import React, { useEffect, useRef } from 'react';
import { Aplayer } from '@nicecode/player';

export default () => {
  const playerRef = useRef();

  return (
    <div>
      <Aplayer
        config={{
          url: [
            {
              src: '//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/music/audio.mp3',
              name: '林宥嘉·脆弱一分钟',
              poster:
                '//sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/music/poster-small.jpeg',
            },
          ],
        }}
      />
    </div>
  );
};
```

### 参考文档

https://v2.h5player.bytedance.com/
npm package: @nicecode/sensitivewords
Description: 1w+敏感词库
Author: nicecoder
Latest version: 0.3.0

# 敏感词合集

## first step

```js
npm install @nicecode/sensitiveWords --save
```

## second step

```js
// you can import this module like that.
// 你可以在项目中这样使用

import words from '@nicecode/sensitiveWords';
```

## join us

[Nicecoders Team](https://github.com/nicecoders/nicecode)
npm package: @nicecode/tools
Description: nicecoders tools
Author: nicecoders
Latest version: 0.4.0

## 使用步骤

### 1. 安装依赖包

```js
npm i @nicecode/tools --save
npm i babel-plugin-import --save-dev
```

### 2. 配置 .babelrc（babel.config.js）

<Alert type="warning">
  属于可选配置，主要是提供按需加载
</Alert>

```json
{
  ...,
  plugins: [
    [
      "import", {
        "libraryName": "@nicecode/func",
        "camel2DashComponentName": false
      }
    ]
  ]
}

```

### 3. 在项目中使用

> 本文以 mathUtil 通用模块为例

```js
import { mathUtil } from '@nicecode/func';

mathUtil.castArray(1);
// => [1]
```

## 模块列表

| 模块        | 说明             |
| ----------- | ---------------- |
| arrayUtil   | 数组方法合集     |
| langUtil    | lang 方法合集    |
| mathUtil    | 数字方法合集     |
| arrayUtil   | 数组方法合集     |
| funcUtil    | 常用函数方法合集 |
| collectUtil | 集合类方法合集   |
| floatUtil   | 数字处理工具集   |
| stringUtil  | 字符串方法集     |
| objUtil     | 对象类方法       |
| validator   | 正则表达式合集   |
| checkDevice | 环境判断工具集   |
| 更多模块... | 开发中...        |

## join us

[Nicecoders Team](https://github.com/nicecoders/nicecode)
npm package: @nicedu/colors
Description: Color palettes calculator of Ant Design
Author: afc163
Latest version: 3.2.2

<h1 align="center">Ant Design Colors</h1>

<div align="center">

:art: Color palettes calculator of [Ant Design](https://ant.design/docs/spec/colors).

[![Travis](https://img.shields.io/travis/ant-design/ant-design-colors/master.svg?style=flat-square)](https://travis-ci.org/ant-design/ant-design-colors)
[![Test coverage](https://img.shields.io/coveralls/ant-design/ant-design-colors.svg?style=flat-square)](https://coveralls.io/r/ant-design/ant-design-colors?branch=master)
[![npm package](https://img.shields.io/npm/v/@ant-design/colors.svg?style=flat-square)](https://www.npmjs.org/package/@ant-design/colors)
[![NPM downloads](http://img.shields.io/npm/dm/@ant-design/colors.svg?style=flat-square)](http://npmjs.com/@ant-design/colors)

[![Dependencies](https://img.shields.io/david/ant-design/ant-design-colors.svg?style=flat-square)](https://david-dm.org/ant-design/ant-design-colors)
[![DevDependencies](https://img.shields.io/david/dev/ant-design/ant-design-colors.svg?style=flat-square)](https://david-dm.org/ant-design/ant-design-colors?type=dev) [![Greenkeeper badge](https://badges.greenkeeper.io/ant-design/ant-design-colors.svg)](https://greenkeeper.io/)
</div>

![](https://user-images.githubusercontent.com/507615/55726820-43e68400-5a43-11e9-8541-b0fc28b78f37.png)

## Install

```bash
$ npm install @ant-design/colors
// or
$ yarn add @ant-design/colors
```

## Usage

```bash
$ npm install @ant-design/colors --save
```

```js
import { red, volcano, gold, yellow, lime, green, cyan, blue, geekblue, purple, magenta, grey } from '@ant-design/colors';

console.log(blue); // ['#E6F7FF', '#BAE7FF', '#91D5FF', ''#69C0FF', '#40A9FF', '#1890FF', '#096DD9', '#0050B3', '#003A8C', '#002766']
console.log(blue.primary); // '#1890FF'
```

```js
import { generate, presetPalettes } from '@ant-design/colors';

// Generate color palettes by a given color
const colors = generate('#1890ff');
console.log(colors); // ['#E6F7FF', '#BAE7FF', '#91D5FF', ''#69C0FF', '#40A9FF', '#1890FF', '#096DD9', '#0050B3', '#003A8C', '#002766']
console.log(presetPalettes);
/*
{
  red: [...],
  volcano: [...],
  orange: [...],
  gold: [...],
  yellow: [...],
  lime: [...],
  green: [...],
  cyan: [...],
  blue: [...],
  geekblue: [...],
  purple: [...],
  magenta: [...],
}
*/
```

## Articles

- [Ant Design Colors](https://ant.design/docs/spec/colors)
- [Ant Design 色板生成算法演进之路](https://zhuanlan.zhihu.com/p/32422584)
npm package: @nicedu/tools
Description: tools for pak design
Author: yiminghe@gmail.com
Latest version: 0.0.3

# @ant-design/tools 🔧🔧🔧

Tools for Pak Design of React: https://github.com/ant-design/ant-design

```bash
pakd-tools run dist
pakd-tools run compile
pakd-tools run clean
pakd-tools run pub
pakd-tools run guard
pakd-tools run compile
pakd-tools run ts-lint
pakd-tools run ts-lint-fix
pakd-tools run deps-lint
pakd-tools run sort-api-table
pakd-tools run api-collection
```
npm package: @niceeli/try-catch
Description: A Go Like try-catch System
Author: niceEli
Latest version: 1.1.0

<h1 align="center"><a href="https://github.com/niceEli/try-catch">Try Catch</a></h1>

<p align="center">A Go Like try-catch System</p>

<p align="center">
	<a href="https://github.com/niceEli/try-catch/blob/main/LICENSE.md" target="_blank"><img alt="📝 License: MIT" src="https://img.shields.io/badge/%F0%9F%93%9D_license-MIT-21bb42.svg" /></a>
	<img alt="💪 TypeScript: Strict" src="https://img.shields.io/badge/%F0%9F%92%AA_typescript-strict-21bb42.svg" />
</p>

## Usage

```shell
bun i @niceeli/try-catch
```

```ts
import safe from "@niceeli/try-catch";

const [data, err, type] = await safe(fetch("https://example.com"));

// data is Response | null
if (err) {
	console.error(`Error: ${err} (${type})`);
	return;
}

// data is Response now, both you and the type system know 100% sure its not null
console.log(data.text());
```