open-index/open-npm huggingface dataset:
npm package: @lancercomet/fetcher
Description: Yet another fetcher.
Author: LancerComet
Latest version: 1.1.2

# Fetcher

Yet another fetcher.

## Quick start

```ts
import { Fetcher } from '@lancercomet/fetcher'

const fetcher = new Fetcher()

const { data, error } = await fetcher.requestJSON({
  url: '/me',
  method: 'GET'
})
```

## Abort a request

```tsx
import { Fetcher } from '@lancercomet/fetcher'

const fetcher = new Fetcher()

const sendRequest = async () => {
  const { data, error } = await fetcher.requestJSON({
    url: '/me',
    method: 'GET'
  })
  // ...
}

const abortRequest = () => {
  fetcher.abort()
}

<button onClick={sendRequest}>Send</button>
<button onclick={abortRequest}>Abort</button>
```

## Work with SunTori

```ts
@Serializable()
class User {
  @JsonProperty('name')
  readonly username: string = ''

  @JsonProperty('age')
  readonly age: number = 0
}

const fetcher = new Fetcher()
const { data } = await fetcher.requestJSON({
  url: '/me',
  method: 'GET',
  type: User
})

data instanceof User  // true
data.username         // string
data.age              // number
```

## Request Binary

```ts
// ArrayBuffer.
const { data: buffer, error } = await fetcher.requestBinary({
  url: '/binary'
}, 'arraybuffer')

// Blob.
const { data: blob, error } = await fetcher.requestBinary({
  url: '/binary'
}, 'blob') 
```

## Request the API

"The API" is a type of data structure which would be like:

```json
{
  "data": ...,
  "code": 0,
  "message": "OK"
}
```

```ts
const { data, error, message, code, status } = await fetcher.requestAPI({
  ...
})
```

## License

Apache-2.0
npm package: @lancercomet/fps-counter
Description: Read fps.
Author: LancerComet
Latest version: 1.0.0

# @lancercomet/fps-counter

[![MyWebLibs](https://github.com/LancerComet/MyWebLibs/workflows/Test/badge.svg)](https://github.com/LancerComet/MyWebLibs/actions)
[![npm version](https://badge.fury.io/js/@lancercomet%2Ffps-counter.svg)](https://badge.fury.io/js/@lancercomet%2Ffps-counter)

A library to read fps.

## Quick start

```ts
import { FpsCounter } from '@lancercomet/fps-counter'

const fpsCounter = new FpsCounter()
const unregisterTick = fpsCounter.onTick((fps: number) => {
  console.log('Fps:', fps)  
})
fpsCounter.start()

// Unregister tick from FpsCounter:
unregisterTick()

// Stop counting:
fpsCounter.stop()

// Read fps directly:
fpsCounter.fps
```

`onTick` triggers every frame.

You can pass use your own throttle function to take it easy. 

## License

Apache-2.0
npm package: @lancercomet/grand-painter
Description: Draw images on canvas with layer effects.
Author: LancerComet
Latest version: 1.0.1

# The Grand Painter

[![npm version](https://badge.fury.io/js/@lancercomet%2Fgrand-painter.svg)](https://badge.fury.io/js/@lancercomet%2Fgrand-painter)

Draw images on canvas with layer effects.

![header-image](https://raw.githubusercontent.com/LancerComet/MyWebLibs/master/GrandPainter/image.jpg)

## Quick start

```typescript
import { paint, Processors } from 'the-grand-painter'

const stageElement = document.getElementById('stage') as HTMLCanvasElement
const imageElement = new Image()

// Put an image on a canvas.
paint({
  stage: stageElement,
  image: imageElement,
  x: 50, 
  y: 50,
  processor: Processors.Normal()
})

// "Overlay" a image on a canvas.
paint({
  stage: stageElement,
  image: imageElement,
  x: 50, 
  y: 50,
  processor: Processors.Overlay()
})
```

## Processor List

 - ColorBurn
 - ColorDodge
 - Darken
 - Dissolve
 - Lighten
 - LighterColor
 - LinearBurn
 - LinearDodge
 - Multiply
 - Normal
 - Overlay
 - Screen
 - Softlight

## Example

Check examples in `dev/` for more information.

## License

Apache-2.0
npm package: @lancercomet/html-parser
Description: A html parser.
Author: LancerComet
Latest version: 0.1.0

# HTML Parser

[![MyWebLibs](https://github.com/LancerComet/MyWebLibs/workflows/Test/badge.svg)](https://github.com/LancerComet/MyWebLibs/actions)
[![npm version](https://badge.fury.io/js/@lancercomet%2Fhtml-parser.svg)](https://badge.fury.io/js/@lancercomet%2Fhtml-parser)

A html parser.

## Quick Start

Parse HTML:

```ts
import { parse } from '@lancercomet/html-parser'

const result = `
  <h1>John Smith</h1>
  <ul>
    <li>Age: 100</li>
    <li>Address: The Mars</li>
  </ul>
`

console.log(result)  // [ASTNode, ASTNode]
```

Create HTML element:

```ts
import { createElement } from '@lancercomet/html-parser'

const element = createElement(new ASTNode())
console.log(element)  // HTMLElement
```

## License

Apache-2.0