open-index/open-npm huggingface dataset:
npm package: @rein_refn/rein-api
Description: A HTTP client for browser. Inspired by axios.
Author: zheng_refn
Latest version: 1.1.3

# rein

[![NPM version](https://img.shields.io/npm/v/npm.svg)](https://www.npmjs.com/package/rein-api)
[![NPM downloads](https://img.shields.io/npm/dw/localeval.svg)](https://www.npmjs.com/package/rein-api)

基于 `fetch` 的 `http` 客户端请求工具，适用于浏览器。(Inspired by [axios](https://github.com/axios/axios) and [apiz](https://github.com/ta7sudan/apiz-ng))

---

## 用法

### 安装
```sh 
yarn add rein-api
```

### 例子

#### 初始化
```js
import Rein from 'rein-api';

// 举例，获取 token
function getCookie(name) {
  //...
}

const instance = new Rein({
  // 是否开启 debug 模式，默认值为 false
  debug: true,  
  // 基础域名，必须配置！
  baseUrl: 'http://www.forchangefe.com/',
  // 接口前缀，默认值为'/'。可用于配合后端微服务。
  defaultPrefix: '/v1',
  // 请求头，默认值为空对象。请遵循 string => string 的格式。按权重 *其他请求头* > *特定方法请求头* > *公用请求头* 覆盖
  headers: {
    // 公用请求头
    'common': {
      Authorization: `Bearer ${getCookie('token')}`
    },
    // 特定方法请求头
    'GET': {
      'Content-Type': 'application/json',
    },
    // 其他请求头...
  },
  // 发送接口前，变异请求数据的方法集合。一般使用默认即可
  transformRequest: [function(data, headers) {
    if (headers.common['X-Log-Data']) {
      console.log(data);
    }
    return data;
  }],
  // 变异请求成功后返回数据的方法集合，同理。
  transformResponse: [function(response) {
    if (!response.hasOwnProperty('errcode')) {
      response.errcode = 0;
    }
    return response;
  }],
})
```

#### 发送请求
```js
instance.request({
  // 方法名，默认为 'get'
  method: 'get',
  // url query 参数
  params: {
    foo: 1,
  },
  // body 参数。注意， rein 底层适配器基于 fetch ， `GET`, `OPTION`, `HEAD` 方法均不允许传入 body 参数
  data: {
    bar: 2
  },
  // 替换 url 上暂位符的参数
  resource: {
    id: 1
  },
  // 请求 url，必须配置。可以为绝对地址，也可以为相对地址。绝对地址则忽略所有拼接 url 的逻辑
  url: '/zoo/{id}',
  // 若 url 上需要拼接暂位符，则必须指定为 true。默认值为 false
  restful: true,
  // 该 api 的指定前缀。若未传入则使用默认前缀。可配合后端微服务使用
  prefix: '/v2',
  // api 元数据，用作标记 api。默认值为空对象
  meta: {
    noAuth: true,
  },
})
.then(res => {
  // 响应数据
  console.log(res);
})
.catch(e => {
  // 报错
  console.error(e);
})
```

## 问答

### 可以推荐点最佳实践吗？
`rein` 采用 `typescript` 来开发。强烈建议您使用 `typescript` ！我们还导出了相关的类型注解，文档不能覆盖的地方，类型注解都帮你解决了。
> 至于如何集成，后续我们会出一篇文章做介绍。

### 生产环境能不能用？
当然，`ForChange Python 小课`日均 200 * 700 订单的报名系统基于这款请求库.

### 为什么叫 `rein` ？

> "I've been called. I have to answer, always."

-- From [OverWatch](http://ow.blizzard.cn/heroes/reinhardt)

<img src="https://user-images.githubusercontent.com/16488686/50585448-f7bdfd80-0eaf-11e9-9585-2839837268d8.jpg" height="200" />

## License

[MIT](https://tldrlegal.com/license/mit-license)
npm package: @reinaldoacdc/gapi-script
Description: package to load gapi script and some functions
Author: Lucas Andrade Oliveira
Latest version: 1.2.0

# gapi-script
[![Generic badge](https://img.shields.io/badge/License-MIT-blue.svg)](https://shields.io/) | [![Generic badge](https://img.shields.io/badge/version-1.2.0-white.svg)](https://shields.io/)
## 💡 Intro
npm package that loads gapi script and initialize some functions.

 - [React live example](https://master.d3dnqnm15vsi52.amplifyapp.com))
 - [React live example project](https://github.com/LucasAndrad/gapi-script-live-example)

Since there is no official package and not even an updated package to load the gapi functions for us, this package make this possible. You can either call `loadGapiInsideDOM` to load the gapi-script inside a `<script>` tag on your browser. Or use the static gapi value that was copied from [google api platform](https://apis.google.com/js/platform.js), pasted to this project and exported as `gapi`.

## 🚀 Usage
Add the package to your project:

```javascript
// npm
npm install --save gapi-script


// yarn
yarn add gapi-script
```

You can load gapi with two different approaches
1 - import `gapi` where you need it:
```javascript
import { gapi } from 'gapi-script';
```

2 - import `gapi` and called somewhere in your app:
```javascript
import { loadGapiInsideDOM } from 'gapi-script';
const gapi = await loadGapiInsideDOM();
```
**After gapi loaded using the 2 approach you can access it on `window.gapi` anywhere in your app**

Once you have gapi you can use it in other functions to make your life easier

If you need to use `gapi auth2` the package already has a function to initialize it:

```javascript
import { loadAuth2, loadAuth2WithProps, loadClientAuth2 } from 'gapi-script';

let auth2 = await loadAuth2(gapi, clientId, scopes);

// or if you need to use more props from gapi you can use this method:
let auth2 = await loadAuth2WithProps(gapi, { /* object with props from gapi */ });

// if you want to use the gapi client itself
let gapiClient = loadClientAuth2(gapi, clientId, scopes);
```

## 📦 Contribution
If you want to contribute just open an issue and send your PR with a good description about it.

**OBS**: the gapi code is copied from this link [google api platform](https://apis.google.com/js/platform.js), and can become outdated any time. I'll dedicate myself to keep it updated always, but if you see any error with gapi load, please open an issue to report about it
npm package: @reinaldooli/nest-casbin
Description: Make magic with [Nest.js](https://github.com/nestjs/nest), [Casbin](https://github.com/casbin/casbin) and [TypeORM](https://github.com/typeorm/typeorm).
Latest version: 0.1.8

# nest-casbin

Make magic with [Nest.js](https://github.com/nestjs/nest), [Casbin](https://github.com/casbin/casbin) and [TypeORM](https://github.com/typeorm/typeorm).

## Example

In `YOUR_PROJECT_ROOT/src/app.module.ts` file:

```typescript
import { Module } from "@nestjs/common";
import { AppController } from "./app.controller";
import { AppService } from "./app.service";
import { CasbinModule } from "@pardjs/nest-casbin";

@Module({
  imports: [
    CasbinModule.forRootAsync(
      {
        type: "mysql",
        host: "localhost",
        port: 3306,
        username: "root",
        password: "",
        database: "casbin"
      },
      "/path/to/the/casbin/model/file.conf"
    )
  ],
  controllers: [AppController],
  providers: [AppService]
})
export class AppModule {}
```

in ``YOUR_PROJECT_ROOT/src/app.service.ts` file:

```typescript
import { Injectable, Inject } from "@nestjs/common";
import { Enforcer } from "casbin";
import { CASBIN_ENFORCER, CasbinService } from "@pardjs/nest-casbin";

@Injectable()
export class AppService {
  constructor(
    @Inject(CASBIN_ENFORCER) private readonly enforcer: Enforcer,
    private readonly casbinService: CasbinService
  ) {}

  getHello(): string {
    return this.casbinService.checkPermission("alice", "data1", "read");
  }
}
```
npm package: @reincarnatedjesus/f-chain
Description: TypeScript function chain lib
Author: wowjeeez
Latest version: 1.1.7

# Installation:
`yarn add @reincarnatedjesus/f-chain` <br>
`npm i @reincarnatedjesus/f-chain`
# Usage:
## Example
```ts
import {createChainedFunction, Context} from "@reincarnatedjesus/f-chain"

const rootFn = (myNum: number) => {
    return myNum
}

const chain = {
    add: (ctx: Context, numToAdd: number) => {
        const root = ctx.getRoot<number>() //get the return of rootFn
        ctx.setResult(root + numToAdd) //if nothing is returned from a chain function, then the chain will be returned automatically
    },
    subtract: (ctx: Context, numToSub: number) => {
        //get the return of the last chain function executed (if there wasn't any then this method is the same as ctx.getRoot) 
        const last = ctx.getLast<number>() 
        ctx.setResult(last - numToSub)
    },
    getLast: (ctx: Context) => ctx.getLast<number>(),
    getSub: (ctx: Context) => ctx.get<number>("subtract"), //will return the result of chain.subtract() (if it was called before)
    getAdd: (ctx: Context) => ctx.get<number>("add") //will return the result of chain.add() (if it was called before)
}

const chainedFunction = createChainedFunction(rootFn, chain)
const chainRes = chainedFunction(11)
const subRes = chainRes.subtract(10).getSub() //context param is omitted by the type system, only the arguments after are shown
chainRes.add(10)
chainRes.subtract(5)
console.log(subRes, chainRes.getAdd(), chainRes.getSub()) //1, 21, 16
```
## Creating chained functions
Every chained function has to be created with the `createChainedFunction` function. <br>
##### Usage: 
`createChainedFunction(executor: Function, chain: Record<string, (ctx: Context, ...args: any) => any>)`
### About the chain
Even though every chain function accepts the context argument, when calling the function the type system will omit that parameter. <br>
For example, if you have a chain function like this: `(ctx: Context, arg1: string, arg2: number) => ...`, when calling it this will appear in your IDE's intellisense: `(arg1: string, arg2: number) => ...` <br> <br>
A function declaration like this: <br>
![Function declaration](https://i.file.glass/nnstNN1tlq.png) <br> 
Will be shown as: <br>
![Function call](https://i.file.glass/TQzwD3VJVM.png)

## Context object
##### Methods:
`getLast`: Returns the last value in the chain or the return of the root function <br>
`get`: Returns a specific function's return in the chain (`ctx.get("myChainFunction")`) <br>
`getRoot`: Returns the result of the root function <br>
`setResult`: Sets a function's result, (used to avoid returning a value so the chain is automatically returned again) <br>
`setValue`: Sets a value in the context that can be resolved with `context.get(key)` <br>
npm package: @reindev/contenteditable-react
Description: This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Latest version: 1.0.1

# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:

- Configure the top-level `parserOptions` property like this:

```js
   parserOptions: {
    ecmaVersion: 'latest',
    sourceType: 'module',
    project: ['./tsconfig.json', './tsconfig.node.json'],
    tsconfigRootDir: __dirname,
   },
```

- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list