open-index/open-npm huggingface dataset:
npm package: @reskit/color
Description: A kit to extract color
Author: simu
Latest version: 1.3.1

## Install

Install `@reskit/color` by `pnpm`

```bash
pnpm add @reskit/color
```

## Usage

```ts
import { extractImageColor, extractImageColorInRust } from "@reskit/color";

const imageLink = "https://avatars.githubusercontent.com/u/38021707?v=4";

extractImageColorInRust(imageLink, 5);
extractImageColor(imageLink, 5);
```

We will extract the top five color at this image.

Sample codes are at [ExtractImageColor](https://github.com/simo-an/reskit/blob/main/projects/reskit-quick-svelte/src/ExtractImageColor.svelte)

> We support extract color at rust code which has higher performance.

## Functions

Extract color at text.

### Extract Hex

```ts
import { extractColor } from "@reskit/color";

extractColor("Color is #5c2b2b");
```

will extract: `["#5c2b2b"]`

### Extract RGB AND HSL

```ts
import { extractColor } from "@reskit/color";

extractColor("Color is rgb(62, 33, 33) and hsl(0, 1%, 66%)");
```

will extract: `["rgb(62, 33, 33)", "hsl(0, 1%, 66%)"]`

### Extract RGBA AND HSLA

```ts
import { extractColor } from "@reskit/color";

extractColor("Color is rgba(62, 33, 33, 0.3) and hsla(0, 30.50%, 18.60%, 0.30)");
```

will extract: `["rgba(62, 33, 33, 0.3)", "hsla(0, 30.50%, 18.60%, 0.30)"]`

## Others

Welcome to contribute and make @reskit/color better!
npm package: @reskit/date
Description: A kit of date extraction
Author: simu
Latest version: 1.3.1

## Install

Install `@reskit/date` by `pnpm`

```bash
pnpm add @reskit/date
```

## Usage

> At current version, we only support extract zh localized date

```ts
import { extractDate, updateLocalized } from "@reskit/date";
import { zhLocalize, createZhRegexp } from "@reskit/date";

updateLocalized({
  useRegexp: createZhRegexp(),
  data: zhLocalize,
});

const result = extractDate("今天早上到明天晚上都要开会！");
```

The result will be today's 10:00 and tomorrow's 20:00

## Others

Welcome to contribute and make @reskit/date better!
npm package: @reskit/emoji
Description: A kit to extract emoji
Author: simu
Latest version: 1.3.1

## Install

Install `@reskit/emoji` by `pnpm`

```bash
pnpm add @reskit/emoji
```

## Usage

### Extract common emoji

Faster and smaller

```ts
import { extractCommonEmoji } from "@reskit/emoji";

extractCommonEmoji("this is the emoji 😁😃😆");
```

Output

```bash
["😁", "😃", "😆"]
```

### Extract full-supported emoji

```ts
import { extractEmoji } from "@reskit/emoji";

extractEmoji("👍🏻👍🏼👍🏽👍🏾👍🏿", true);
```

Output

```bash
["👍🏻", "👍🏼", "👍🏽", "👍🏾", "👍🏿"]
```

## Others

Welcome to contribute and make @reskit/emoji better!
npm package: @reskit/link
Description: A kit to extract link
Author: simu
Latest version: 1.3.1

## Install

Install `@reskit/link` by `pnpm`

```bash
pnpm add @reskit/link
```

## Functions

### Extract Link

Input

```ts
import { extractLink } from "@reskit/link";

extractLink("the link is: ftp://192.168.0.111/");
```

Output

```bash
["ftp://192.168.0.111/"]
```

### Extract Multiple Links

```ts
extractLink("the link is: http://www.google.com:80/s?wd=vue#page and mailto://www.baidu.com/s !");
```

Output

```ts
["http://www.google.com:80/s?wd=vue#page", "mailto://www.baidu.com/s"];
```

### Extract Link From a Tag

```ts
extractLink("the link is: <a target='_blank' href='http://www.baidu.com/'>Baidu</a>");
```

Output

```bash
["http://www.baidu.com/"]
```

### Extract Path-Like Link

```ts
extractLink("the path is: ./usr/local/bin", { includePath: true });
```

Output

```bash
["./usr/local/bin"]
```

## Others

Welcome to create PR and make @reskit/link better!
npm package: @reskit/location
Description: A kit to extract location
Author: simu
Latest version: 1.3.1

## Install

Install `@reskit/location` by `pnpm`

```shell
pnpm add @reskit/location
```

## Run A Demo

We don't have built in data.
You should set locations by `updateLocations` at first.

```typescript
import { updateLocations, extractLocation } from "@reskit/location";

updateLocations([
  {
    name: "A",
    items: [
      {
        name: "B",
        items: [
          {
            name: "C",
            items: [{ name: "Suzhou", alias: "Gusu" }],
          },
          { name: "Mars", alias: ["Martis", "Huoxing"] },
        ],
      },
    ],
  },
]);
```

```typescript
import { extractLocation, updateLocations } from "@reskit/location";

console.warn(extractLocation("Let's have a meeting at Gusu tomorrow"));
console.warn(extractLocation("Let's have a meeting at Martis tomorrow"));
```

The output will be

```text
["A/B/C/Suzhou"]
["A/B/Mars"]
```

## Apply to you project

Create a company that have two buildings `Headquarters` and `Affiliate`.

```typescript
const building1 = [
  {
    name: "2F",
    items: [
      { name: "Agora", alias: "shengwang" },
      "Stonehenge",
      {
        name: "East",
        items: [{ name: "Colosseum", alias: ["theatre", "great theatre"] }],
      },
    ],
  },
  {
    name: "3F",
    items: [{ name: "Suzhou", alias: "Gusu" }, "Hangzhou"],
  },
];

const building2 = [
  {
    name: "1F",
    items: [
      { name: "MountHuang", alias: "Mount-Huang" },
      { name: "Chizhou" },
      "Great Wall",
      "Google",
    ],
  },
];

const buildings = [
  { name: "Headquarters", items: building1 },
  { name: "Affiliate", items: building2 },
];
```

Update locations

```typescript
import { updateLocations } from "@reskit/location";

updateLocations(buildings);
```

Extract location from text

```typescript
import { extractLocation, updateLocations } from "@reskit/location";

console.warn(extractLocation("Let's have a meeting at the great theatre tonight."));
```

The console will output

```text
["Headquarters/2F/East/Colosseum"]
```

## Functions

Custom divider

```typescript
import { extractLocation, updateLocations, updateDivider } from "@reskit/location";

updateDivider("-");

console.warn(extractLocation("Let's have a meeting at Gusu tonight."));
```

The console will output

```text
["Headquarters-3F-Suzhou"]
```

Output all the same locations

```typescript
import { extractLocation, updateLocations, updateDivider } from "@reskit/location";

console.warn(extractLocation("Let's have a meeting at Chizhou! (Chizhou not Hangzhou!).", false));
```

The console will output

```text
[
  "Affiliate-1F-Chizhou",
  "Affiliate-1F-Chizhou",
  "Headquarters-3F-Hangzhou"
]
```

## Others

Welcome to create PR and make reskit/location better!
npm package: @reskit/math-expression
Description: A kit to extract math-expression
Author: simu
Latest version: 1.3.1

## Install

Install `@reskit/math-expression` by `pnpm`

```bash
pnpm add @reskit/math-expression
```

## Functions

You should import method:

```typescript
import { extractMathExpression, computeMathExpression } from "@reskit/math-expression";
```

### Extract Math Expression

Input

```typescript
extractMathExpression("Calculate 1+3+4-5");
```

Output

```bash
["1+3+4-5"]
```

You can compute it by `@reskit/shared`

Input

```typescript
import { calculate } from "@reskit/shared";

calculate("1+3+4-5");
```

Output

```bash
3
```

### Compute Math Expression

```typescript
computeMathExpression("Answer: 1+ 3+(4-5)*6/ 3");
```

Output

```bash
Answer: 2
```

### Compute Decimal

Input

```typescript
computeMathExpression("Answer: 65+28.6+35+71.4");
```

Output

```bash
Answer: 200
```

### Multiple Math Expression

Input

```ts
computeMathExpression("Answer: A = 65+28.6+(1 + 35/7)+71.4; B = 1.1+1.2+1.3+1.4");
```

Output

```bash
Answer: A = 200; B = 5
```

## Others

Welcome to create PR and make @reskit/math-expression better!
npm package: @reskit/number
Description: A kit to extract number
Author: simu
Latest version: 1.3.1

## Install

Install `@reskit/number` by `pnpm`

```shell
pnpm add @reskit/number
```

## Setup

```ts
import { extractNumber } from "@reskit/number";

const result = extractNumber("The numbers are: 1. 3030.222 and 899.90");
```

The kit will extract number from text, console will output

```bash
[1, 3030.222, 899.9]
```

## Localized

Before use `@reskit/number` to extract localized number, you should set localized data.

> At current version , we only have build in chinese data

```typescript
import { extractNumber, updateLocalized, replaceNumber } from "@reskit/number";
import { zhLocalize, zhAlgorithm, createZhRegexp } from "@reskit/number";

updateLocalized(
  {
    ...zhLocalize,
    regexp: createZhRegexp(),
  },
  zhAlgorithm
);
```

After prepared, run a test demo

```typescript
const result = extractNumber(
  "我想明天中午十二点和三个人走1千多米，花费十七点五万元，有百分之四十的概率温度在二十三摄氏度"
);

console.info(result);
```

The console will output:

```text
[12, 3, 1000, 175000, 0.4, 23]
```

## Functions

### Extract Decimal

```typescript
const result = extractNumber("整个路程有1.2千米");
```

The console will output:

```bash
result: [1200]
```

### Extract Fraction

```typescript
const result = extractNumber("这里有四分之三的人在说活");
```

The console will output:

```bash
result: [0.75]
```

### Extract Negative Number

```typescript
const result = extractNumber("答案是负的一又十分之四");
```

The console will output:

```bash
result: [-1.4]
```

### Keep raw text

```typescript
const result = extractNumber(
  "我想订明天中午十二点的餐馆，三个人，走路1千多米能到，十七点五万元以内，预留手机号为18619994211，明天二十三摄氏度",
  false
);
```

The console will output:

```bash
result: ["十二", "三", "1千", "十七点五万", "18619994211", "二十三"]
```

### Just replace number

```typescript
const result = replaceNumber("造价在十七点五万元以内");
```

The console will output:

```bash
result: 造价在175000元以内
```

## Others

Welcome to create PR and make reskit/number support your country's language!