open-index/open-npm huggingface dataset:
npm package: @starryinternet/map-memo
Description: Generic memoization with Map and WeakMap
Author: Kevin Ennis
Latest version: 2.1.2

# map-memo

[![Build Status](https://travis-ci.org/StarryInternet/map-memo.svg?branch=master)](https://travis-ci.org/StarryInternet/map-memo)

Generic memoization using `Map` and `WeakMap`.

---

### Installing

```
npm install --save @starryinternet/map-memo
```

---

### What/Why?

Memoization in JavaScript has typically been limited to arguments
with primitive values, or by utilizing hacks such as stringifying objects.

By storing arguments using a series of nested cache objects backed by `Map`
and `WeakMap`, `map-memo` is able to memoize functions with *any*
argument types.

---

### Example

```js
'use strict';

const memoize = require('@starryinternet/map-memo');

function loop( fn, n ) {
  let v;

  for ( let i = 0; i < n; ++i ) {
    v = fn( i );
  }

  return v;
}

let mem = memoize( loop );

console.log( mem( Math.sqrt, 1e9 ) ); // slow
console.log( mem( Math.sqrt, 1e9 ) ); // fast!
```

### Example with expire time in milliseconds

```js
'use strict';

const memoize = require('@starryinternet/map-memo');

function getRandom() {
  return Math.random();
}

let mem = memoize( getRandom, { ttl: 1000 } );
console.log( mem() );
console.log( mem() ); // Same value as above

setTimeout( function() {
  console.log( mem() ); // Different value
}, 1001 );
```

### Example with asynchronous function

```js
'use strict';

const memoize = require('@starryinternet/map-memo');

function loopAsync( fn, n ) {
  return new Promise( ( resolve, reject ) => {
    let v;

    for ( let i = 0; i < n; ++i ) {
      v = fn( i );
    }

    resolve( v );
  });
}

let mem = memoize( loopAsync );

mem( Math.sqrt, 1e9 ).then( result => {
  console.log( result ); // slow
  mem( Math.sqrt, 1e9 ).then( console.log ); // fast!
});
```
npm package: @starryinternet/nyc-config-starry
Description: Starry's sharable nyc config
Author: Starry Internet
Latest version: 1.0.0

# nyc-config-starry

Starry's sharable nyc config.

## Usage

```json
{
  "devDependencies": {
    "nyc-config-starry": "<current version>"
  },
  "nyc": {
    "extends": "nyc-config-starry"
  }
}
```

See [the nyc docs](https://www.npmjs.com/package/nyc#adding-your-overrides) for more information about how to configure nyc.
npm package: @starryn/annotator
Description: a lightweight dataset annotator for ai
Author: moon
Latest version: 1.0.0

# @starryn/annotator

a lightweight editor for dataset annotating.

### Setup

```
npm i -S @starryn/annotator
```

### Features

![config object](https://raw.githubusercontent.com/iyouw/voyager-assets/main/annotator/config_object.png)

![nature](https://raw.githubusercontent.com/iyouw/voyager-assets/main/annotator/nature.png)

![object](https://raw.githubusercontent.com/iyouw/voyager-assets/main/annotator/object.png)

![object attr](https://raw.githubusercontent.com/iyouw/voyager-assets/main/annotator/object_attr.png)

![pan](https://raw.githubusercontent.com/iyouw/voyager-assets/main/annotator/pan.png)

![relation](https://raw.githubusercontent.com/iyouw/voyager-assets/main/annotator/relation.png)

![zoom](https://raw.githubusercontent.com/iyouw/voyager-assets/main/annotator/zoom.png)

### architecture

![arch](https://raw.githubusercontent.com/iyouw/voyager-assets/main/annotator/arch.jpg)

[arch detail](https://www.processon.com/view/link/6555e206a10c1003f74ff6a6)
npm package: @starryn/util
Description: basic tools
Author: moon
Latest version: 1.2.0

# @starryn/util

a base util library

### features
  + typings & typings guards
  + string operation
  + math operation
  + tree operation
  + hash algorithm
  + binary encoding & decoding
  + collections
  + functions
  + style relevants
  + dom relevants

### demos

some basic usage for some modules

##### typings

```typescript
import {Action, Action2, Func, Func2, Predicate, Tuple, Tuple2} from '@starryn/util'

const action: Action<string> = (arg： string): void => console.log(arg);
const action2: Action2<string, number> = (arg1: string, arg2: number): void => console.log(arg1, arg2);


const func: Func<string, boolean> = (arg: string): boolean => !!arg;
const func2: Func<string, number, boolean> = (arg1: string, arg2: number): boolean => !!(arg1 + arg2);

const predicate: Predicate<number> = (arg: number): boolean => arg === 5;

const tuple: Tuple<number> = [2];
const tuple2: Tuple2<number, string> = [2, 'hello world'];

```

##### string operation

```typescript
import { pad, padRight, kebablize, pascalize, camelize } from '@starryn/util'

console.log(pad('12', 4))                 // 0012
console.log(pad('12', 4, 'nn'))           // nn12

console.log(padRight('12', 4))            // 1200
console.log(padRight('12', 4, 'nn'))      // 12nn

console.log(kebablize('HelloWorld'))      // hello-world
console.log(pascalize('hello-world'))     // HelloWorld
console.log(camelize('HelloWorld'))       // helloWorld
console.log(camelize('hello-world'))      // helloWorld
```


##### math operation

```typescript
import { clamp, toFixedEx } from '@starryn/util'

console.log(clamp(-1, 0, 100))                            // 0
console.log(clamp(101, 0, 100))                           // 100
console.log(clamp(2, 0, 100))                             // 2

console.log(toFixedEx(99.9999,2), 99.9999.toFixed(2))     // 99.99  100.00
```

##### hash algorithm

```typescript
import { murmurHash3, Murmur3 } from '@starryn/util';

(async()=>{
  const str = 'hello world';
  
  const hash1 = murmurHash3(str);                 // use javascript float number
  const hash2 = await Murmur3.hash32Async(str);   // use strickly int32 number

  console.log(hash1, hash2, hash1 === hash2);
})();

```

##### style relevant

```typescript
import { createRoot } from '@starryn/util';

const [bem] = createRoot('o');

console.log(bem('btn'))       // o-btn
console.log(bem('btn',{active: true, hide: false}))   // o-btn o-btn--active
console.log(bem('btn', ['long']))                     // o-btn o-btn--long
cossole.log(bem('btn', ['long',{active: true}]))      // o-btn o-btn--long o-btn--active
```

##### functions

```typescript
import { debounce, throttle } from '@starryn/util';

const dfunc = debounce(()=>console.log(1), 200)         //  ship from lodash
const tfunc = throttle(() => console.log(2), 300)       // ship from lodash
```
npm package: @starryn/vision
Description: a lightweight library for canvas
Author: moon
Latest version: 1.0.0

## 下载(以pnpm 为例)

> pnpm add @starryn/vision

## 使用案例

```vue
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { Vision } from '@starryn/vision'

const divRef = ref<HTMLDivElement>();
const painter = new Vision({
  borderColor: 'yellow'
});

onMounted(() => {
  painter.mount(divRef.value!);
  painter.batchDraw([
    {
      x: 20,
      y: 20,
      width: 100,
      height: 100
    }
  ])
});
</script>
```

```
<template>
  <div ref="divRef"></div>
</template>
```

### 参数配置
##### new Vision(opt)

 - 参数opt ：基础配置项
 
|配置字段  |说明 | 类型|
|--|--|--|
|borderColor | 边框颜色|string|
|borderWidth|  边框宽度|number|
|backgroundColor|背景颜色| string|
|fontColor|  label字体颜色|string|
|fontSize|  label字体大小|number
|fontBgColor|  label的背景颜色|string|
|contentDescribeStyle|  文字列表样式（以对象展示）|
 - contentDescribeStyle 配置对象

| 配置字段 | 说明 | 类型|
|--|--|--|
| fontColor |  文字颜色|string
| fontSize|  文字大小|number
| backgroundColor|  文字的背景颜色|string
| width|  文字宽度（默认为160px）|number


### mount(root: HTMLDivElement)方法

组件挂载到 `dom` 中,调用绘图方法前，需要挂载组件。

|配置字段  |说明 | 类型|
|:--|:--|:--|
| root | 组件挂载到dom中的位置 | HTMLDivElement |

### batchDraw()方法
调用画框方法，传递一个数组参数 [obj,obj]
obj 的配置
|配置字段 |说明 | 类型|是否必须(y/n)|
|:--|:--|:--:|:--:|
|x|x轴点位（以canvas的左上角为原点）| number | **y** |
|y|y轴点位（以canvas的左上角为原点）| number | **y** |
|width| 画框的宽度|number | **y** |
|height| 画框的高度|number| **y** |
|borderWidth|  画框的边框宽度|number| `n` |
|borderColor|  画框的边框颜色|string | `n` |
|backgroundColor| 画框的背景颜色|string | `n` |
|label|  label文字描述|string | `n` |
|fontColor|  label字体颜色|string | `n` |
|fontSize|  label字体大小|number | `n` |
|fontBgColor|  label的背景颜色|string | `n` |
|contentDescribe| 文字列表展示（以数组对象展示）|||
|contentDescribeStyle|  文字列表样式|
 - contentDescribe
 contentDescribe:[obj,obj]
 obj配置
 
| 配置字段 | 说明 |类型|
|--|--|--|
|label  |文字描述  |string
npm package: @starscream/routewise-cors
Description: A fork of `@fastify/cors` that allows changing cors options easily on a per-scope or per-route basis.
Latest version: 0.1.0

# @starscream/routewise-cors

A fork of `@fastify/cors` that allows changing cors options easily on a per-scope or per-route basis.

You register this plugin once, and then within any scopes you want, you can set cors options, or override parent scope's cors options. You can also set CORS options or overrides on individual routes.

Works by always being ambiently registered, and tracking what the current options are throughout the Fastify plugin encapsulation tree. When a new route is added, the right CORS options for that route are resolved, and a parallel OPTIONS route is registered for that route that serves those options.

## Differences from `@fastify/cors`

- `@fastify/cors` can only be registered once per encapsulation scope, so you can't override it lower down
- `@fastify/cors` must be given all the options when it is registered
- `@fastify/cors` applies by default to all routes in a scope, and then allows disabling CORS for individual routes, but not adjusting options for individual routes, whereas we want the opposite for Gadget apps, where CORS is off by default and then you can opt in on a route-by-route or scope-by-scope basis.

Because of the above, `@fastify/cors` is hard to include by default in Starscream in a "sitting waiting for you to need it" mode, whereas `@starscream/routewise-cors` can be exactly that.