open-index/open-npm huggingface dataset:
npm package: @sparrow-vis/sparrow
Description: Sparrow is a tiny plot library based on the grammar of graphics for learning purpose.
Latest version: 0.0.3

# 🦜 Sparrow

Sparrow is a tiny plot library based on the grammar of graphics for learning purpose. It aims at helping people to better understand visualization and making it easier for them to choose the the suitable visualization library for their analysis task.

![](https://gw.alipayobjects.com/mdn/rms_38d0f7/afts/img/A*pLBGQoXodSoAAAAAAAAAAAAAARQnAQ)

![](https://gw.alipayobjects.com/mdn/rms_38d0f7/afts/img/A*romnSZgAWacAAAAAAAAAAAAAARQnAQ)

## 📎 Links

- [Introduction](https://sparrow-vis.github.io/)
- [Tutorials in Chinese](https://juejin.cn/book/7031893648145186824)

## ✨ Features

The name **sparrow** comes from an old Chinese proverb: "Though sparrow is small, but it has all organs". As its name, Sparrow has the following features:

- **Small**: The code is less than 2000 lines in total **with zero dependencies**.
- **Elegant**: It can plot in both normal and sketchy, hand-drawn-like, style.
- **Complete**: It can plot most of charts in common use.

## 📦 Installation

```
$ npm i @sparrow-vis/sparrow
```

## 🔨 Get Started

- Specifies chart by **JavaScript Object**.

```js
import { plot } from "@sparrow-vis/sparrow";

const data = [
  { genre: "Sports", sold: 275 },
  { genre: "Strategy", sold: 115 },
  { genre: "Action", sold: 120 },
  { genre: "Shooter", sold: 350 },
  { genre: "Other", sold: 150 },
];

const chart = plot({
  data,
  type: "interval",
  encodings: {
    x: "genre",
    y: "sold",
    fill: "genre",
  },
});

document.getElementById("container").appendChild(chart);
```

![example](https://gw.alipayobjects.com/mdn/rms_38d0f7/afts/img/A*y8rbTKLcnfMAAAAAAAAAAAAAARQnAQ)

- Plot in a sketchy, hand-drawn-like, style.([@sparrow-vis/rough-renderer](https://github.com/sparrow-vis/rough-renderer))

```
$ npm i @sparrow-vis/rough-renderer
```

```js
import { plot } from "@sparrow-vis/sparrow";
import { createPlugin } from "@sparrow-vis/rough-renderer";

const data = [
  { genre: "Sports", sold: 275 },
  { genre: "Strategy", sold: 115 },
  { genre: "Action", sold: 120 },
  { genre: "Shooter", sold: 350 },
  { genre: "Other", sold: 150 },
];

const chart = plot({
  data,
  type: "interval",
  renderer: createPlugin(),
  encodings: {
    x: 'genre',
    y: 'sold',
    fill: 'genre'
  },
});

document.getElementById("container").appendChild(chart);
```

![](https://gw.alipayobjects.com/mdn/rms_38d0f7/afts/img/A*sq8vSp37hIQAAAAAAAAAAAAAARQnAQ)

## 😝 Thanks

The API design is inspired by the following awesome projects [G2](https://github.com/antvis/G2), [Vega-Lite API](https://github.com/vega/vega-lite-api) and [Observable Plot](https://github.com/observablehq/plot).

## 📄 License

MIT
npm package: @sparrowend/isoffline
Description: is online and offline on nodejs; 检测网络状态（nodejs）
Author: sparrow
Latest version: 0.0.5

# sp-isoffline
1. is online on nodejs by ping hosts: www.baidu.com, weixin.qq.com...
2. offline to online on nodejs 

## Install
`npm install sp-isoffline`
or
`yarn add sp-isoffline`

## api
### isonline: 
`网络是否处于在线状态(一次性（ one-off ）) code: `
```js
import {isonline} from 'sp-isoffline'

/*
 * dnses: [...]
 */
isonline().then(status => {
    if(status) {
        // online
    }else {
        // offline
    }
})
```

### offlineListener：
`网络监听器， 默认三秒 轮询 code：`

```js 
offlineListener({
    time: 1000, // 间隔
    // interval: 9, // 次数
    offline(callback) { // 网络断开
        console.log('网络断开')
        callback(({ status }) => {
            if (status) console.log('联网成功')
            else console.log('网络连接失败')
        })
    },
    online({ status }) { // 网络正常情况下
        if (status) console.log('网络正常')
    }
})
```
npm package: @sparrowend/proxy-server
Description: production proxy server (http-server),  after packaged agent
Author: sparrow
Latest version: 1.0.8

## Production Proxy Server or Match Local File

>Do: If you want to be a proxy server, you need to use local files according to different rules. Then you can use this tool；

## Using 
- `pnpm add sproxy-server`
  
  - `Using Cli`
    `sproxy-server xxx.config.js` Or `proserver.config.js` for the project root, Run again `sproxy-server`

  - `Using Code`
    ```js 
        import proServer from 'sproxy-server';
        proServer(config);
        // in case you want to use middleware: 
        proServer.app.use((req,res,next) => {});
        // in case you want rewrite `defineConfig`
        proServer.defineConfig(Object);
    ```


## Config File
`"proserver.config.js" is for the root directory` Or `sproxy-server xxx.config.js`;

1. "proserver.config.js" is for the root directory -> `sproxy-server`
2. sproxy-server xxx.config.js -> `sproxy-server xxx.config.js`


> For details about parameter Settings, see [Details](types/index.d.ts)


### 🌰
```js
module.exports = {
    port?: 24678,
    open?: true,
    contentBase: '../__test__',
    host?: '127.0.0.1',
    decodeFunction?: () => {
        return [
            {
                url: '/a/b',
                format(req,res,data) {
                    return 'Ok'
                }
            }
        ]
    },
    proxy: {
        '/': {
            target: 'http://123.4.5:9999/',
            intercept?: (req,res,data) => `<div>Switch</div>`,
            bypass?: (req,res) => {
                if(req.url.indexOf('__test__') > -1) {
                    return '/bin/index.mjs'
                }
            }
        },
        '/a': {

        }
    }
}
```
npm package: @sparrowengg/api-docs-plugin
Description: ## Setup
Latest version: 0.0.11

# @sparrowengg/api-docs-plugin

## Setup

```
yarn
yarn start
```

Once the modules are generated, you can test the plugin by using the yarn link command.

Run

```
yarn link
```

to create a symlink to this project and run

```
yarn link @sparrowengg/api-docs-plugin
```

in the project you wish to use this plugin.
npm package: @sparrowengg/twigs-charts
Description: Charts package for SurveySparrow
Latest version: 0.0.7

# Twigs Charts

## Installation

```bash
yarn add @sparrowengg/twigs-charts
```

Recharts is a peer dependency and should be installed separately.

```bash
yarn add recharts
```

## Usage

```tsx
import { ThemeProvider, BarChart } from "@sparrowengg/twigs-charts";

<ChartThemeProvider
  theme={{
    colors: {
      list: [
        "#7158F5",
        "#EE7D61",
        "#98E0D8",
        "#EFBE55",
        "#84CC16",
        "#C3705C",
        "#F5C78E",
      ],
    },
    fontFamily: "DM Sans",
    fontFamilyAlternate: "DM Mono",
  }}
>
  <BarChart
    dataKey="month"
    data={[
      {
        month: "Jan",
        "Active Users": 4000,
      },
      {
        month: "Feb",
        "Active Users": 3000,
      },
      {
        month: "Mar",
        "Active Users": 2000,
      },
      {
        month: "Apr",
        "Active Users": 2780,
      },
      {
        month: "May",
        "Active Users": 1890,
      },
      {
        month: "Jun",
        "Active Users": 2390,
      },
      {
        month: "Jul",
        "Active Users": 3490,
      },
    ]}
    series={[
      {
        name: "Active Users",
        color: "$list.0",
      },
    ]}
  />
</ThemeProvider>
```