open-index/open-npm huggingface dataset:
npm package: @lsd-aus/eslint-config
Description: Luke's personal eslint config
Author: Luke Secomb
Latest version: 1.0.2

# @lsd-aus/eslint-config

[![npm](https://img.shields.io/npm/v/@lsd-aus/eslint-config.svg)](https://www.npmjs.com/package/@lsd-aus/eslint-config)

## Installation

```bash
yarn add @lsd-aus/eslint-config
```

## Usage

We have 2 differents configs, reference the one you need in your `.eslintrc`

**For Vanilla javascript**

```json
{
  "extends": "@lsd-aus/eslint-config/vanilla"
}
```

**For React**

```json
{
  "extends": "@lsd-aus/eslint-config/react"
}
```

**For TypeScript**

```json
{
  "extends": "@lsd-aus/eslint-config/typescript"
}
```

## License

MIT &copy; [Luke Secomb.](http://lukesecomb.digital)
npm package: @lsd-aus/prettier-config
Description: Luke's personal Prettier config
Author: Luke Secomb
Latest version: 1.0.2

# @lsd-aus/eslint-config

[![npm](https://img.shields.io/npm/v/@lsd-aus/prettier-config.svg)](https://www.npmjs.com/package/@lsd-aus/prettier-config)

## Installation

```bash
yarn add @lsd-aus/prettier-config
```

## Usage

```json
// package.json
{
  "name": "my-projects-name",
  "prettier": "@lsd-aus/prettier-config",
  "devDependencies": {
    "@lsd-aus/prettier-config": "^1.0.0"
  }
}
```

```json
// `.prettierrc.json`
"@lsd-aus/prettier-config"
```

```js
// `prettier.config.js` or `.prettierrc.js`
module.exports = '@lsd-aus/prettier-config';
```

> can be used the same as [this](https://www.npmjs.com/package/prettier-config-standard) package. see for `extend` config.

## License

MIT &copy; [Luke Secomb.](http://lukesecomb.digital)
npm package: @lsd-aus/stylelint-config
Description: lsd-aus's stylelint config
Author: Luke Secomb
Latest version: 1.0.2

# @lsd-aus/stylelint-config

[![npm](https://img.shields.io/npm/v/@lsd-aus/stylelint-config.svg)](https://www.npmjs.com/package/@lsd-aus/stylelint-config)

## Installation

```bash
yarn add @lsd-aus/stylelint-config
```

## Usage

Reference the config in your `.stylelintrc`:

```json
{
  "extends": "@lsd-aus/stylelint-config"
}
```

## License

MIT &copy; [Luke Secomb.](http://lukesecomb.digital)
npm package: @lsd-aus/tslint-config
Description: lsd-aus's tslint config
Author: Luke Secomb
Latest version: 1.0.2

# @lsd-aus/tslint-config

[![npm](https://img.shields.io/npm/v/@lsd-aus/tslint-config.svg)](https://www.npmjs.com/package/@lsd-aus/tslint-config)

## Installation

```bash
yarn add @lsd-aus/tslint-config
```

## Usage

### TSLint

For now there is only one main config.

**For React**

```json
{
  "extends": "@lsd-aus/tslint-config/react"
}
```

In the future we may add additional tslint configs.

### TSConfig

For now there is only one main config.

**For React**

```json
{
  "extends": "./node_modules/@lsd-aus/tslint-config/tsconfig-react",
  "compilerOptions": {
    "baseUrl": "./src"
  }
}
```

In the future we may add additional tsconfigs.

## License

MIT &copy; [Luke Secomb.](http://lukesecomb.digital)
npm package: @lsdafjklsd/essence
Description: it's a lib to build js apps
Author: Haywood
Latest version: 0.0.3

```javascript
import {update, state, ui, render} from "@lsdafjklsd/essence"

const appState = state({
  count: 0
})

const resetCount = () => {
  update(appState, appState => {
    appState.count = 0
    return appState
  })
}

const incrementCount = () => {
  update(appState, appState => {
    appState.count = appState.count + 1
    return appState
  })
}

const decrementCount = () => {
  update(appState, appState => {
    appState.count = appState.count - 1
    return appState
  })
}

const App = ui(() => {
  return (
    <div style={{display: "flex", flexDirection: "column", width: 300}}>
      <h1 onClick={resetCount}>
        <strong>current count: {appState.count}</strong>
      </h1>

      <button onClick={incrementCount}>
        increment count
      </button>

      <br />

      <button onClick={decrementCount}>
        decrement count
      </button>
    </div>
  )
})

render(<App />, document.getElementById("root"))
```

Almost no library or framework code, just works thanks to Mobx and React. Reagent is the next step after react-redux. This attempts to emulate Reagent using JS libs. This was composed to teach beginners, no frameworks to learn, 4 functions, just focus on creating functions that return html and functions that modify data.

MIT
npm package: @lsdkit/core
Description: LSDKIT工具集核心库
Latest version: 0.0.98

# core

#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}

#### Software Architecture
Software architecture description

#### Installation

1.  xxxx
2.  xxxx
3.  xxxx

#### Instructions

1.  xxxx
2.  xxxx
3.  xxxx

#### Contribution

1.  Fork the repository
2.  Create Feat_xxx branch
3.  Commit your code
4.  Create Pull Request


#### Gitee Feature

1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4.  The most valuable open source project [GVP](https://gitee.com/gvp)
5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
npm package: @lsdkit/di
Description: 该项目提供了一个基于 TypeScript 实现的依赖注入（DI）容器，用于管理应用程序中的对象生命周期和依赖关系。支持三种不同的服务生命周期：**瞬态（Transient）**、**单例（Singleton）** 和 **创建工厂**。
Latest version: 1.1.3

# di

#### Description
依赖注入容器
该项目提供了一个基于 TypeScript 实现的依赖注入（DI）容器，用于管理应用程序中的对象生命周期和依赖关系。支持三种不同的服务生命周期：瞬态（Transient）、单例（Singleton） 和 创建工厂。

#### Software Architecture
Software architecture description

#### Installation

1.  xxxx
2.  xxxx
3.  xxxx

#### Instructions

1.  xxxx
2.  xxxx
3.  xxxx

#### Contribution

1.  Fork the repository
2.  Create Feat_xxx branch
3.  Commit your code
4.  Create Pull Request


#### Gitee Feature

1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4.  The most valuable open source project [GVP](https://gitee.com/gvp)
5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
npm package: @lsdkit/fs
Description: 这是一个基于 TypeScript 封装的 Node.js 文件操作和监控库，旨在简化文件系统管理相关的业务集成。通过这个库，您可以更方便地进行文件操作、文件系统监控等任务。
Author: lusida
Latest version: 1.0.9

# fs

#### Description
这是一个基于 TypeScript 封装的 Node.js 文件操作和监控库，旨在简化文件系统管理相关的业务集成。通过这个库，您可以更方便地进行文件操作、文件系统监控等任务。

#### Software Architecture
Software architecture description

#### Installation

1.  xxxx
2.  xxxx
3.  xxxx

#### Instructions

1.  xxxx
2.  xxxx
3.  xxxx

#### Contribution

1.  Fork the repository
2.  Create Feat_xxx branch
3.  Commit your code
4.  Create Pull Request


#### Gitee Feature

1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4.  The most valuable open source project [GVP](https://gitee.com/gvp)
5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
npm package: @lsdkit/lc
Description: lc
Author: 'magar'
Latest version: 1.1.0

# lc

#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}

#### Software Architecture
Software architecture description

#### Installation

1.  xxxx
2.  xxxx
3.  xxxx

#### Instructions

1.  xxxx
2.  xxxx
3.  xxxx

#### Contribution

1.  Fork the repository
2.  Create Feat_xxx branch
3.  Commit your code
4.  Create Pull Request


#### Gitee Feature

1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4.  The most valuable open source project [GVP](https://gitee.com/gvp)
5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
npm package: @lsdkit/net
Description: JSON-RPC客户端服务器解决方案
Author: lusida
Latest version: 1.0.7

# net

#### Description
JSON-RPC客户端服务器解决方案

#### Software Architecture
Software architecture description

#### Installation

1.  xxxx
2.  xxxx
3.  xxxx

#### Instructions

1.  xxxx
2.  xxxx
3.  xxxx

#### Contribution

1.  Fork the repository
2.  Create Feat_xxx branch
3.  Commit your code
4.  Create Pull Request


#### Gitee Feature

1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4.  The most valuable open source project [GVP](https://gitee.com/gvp)
5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
npm package: @lsdsoftware/message-dispatcher
Description: Extract boilerplate message dispatching logic into a reusable module
Author: Hai Phan
Latest version: 2.0.0

# message-dispatcher
Dispatch received messages to handlers.  This utility assumes messages are one of three types: request, response, or notification; and follow this format:

```typescript
interface Request {
  from: string
  to: string
  type: "request"
  id: string
  method: string
  args?: Record<string, unknown>
}

interface Notification {
  from: string
  to: string
  type: "notification"
  method: string
  args?: Record<string, unknown>
}

interface Response {
  from: string
  to: string
  type: "response"
  id: string
  error: unknown
  result: unknown
}
```


## Usage
Call `dispatch` to dispatch a received message.  Only messages whose `from` and `to` attributes match those of the dispatcher will be processed.

Requests and notifications are dispatched to handlers provided during construction, while responses are dispatched to response listeners.  To listen for a response, call `waitForResponse` with the request ID.

```typescript
import { makeMessageDispatcher } from "@lsdsoftware/message-dispatcher"

const iframe1MessageDispatcher = makeMessageDispatcher({
  from: "iframe1",
  to: "main",
  requestHandlers: {
    method1(args, sender) {
      //do something
      return result
    },
    async method2(args, sender) {
      //do something
      return result
    }
  }
})

//process messages from iframe1
window.addEventListener("message", event => {
  const sender = {window: event.source, origin: event.origin}
  iframe1MessageDispatcher.dispatch({
    message: event.data,
    sender: sender,
    sendResponse: response => sender.window.postMessage(response, sender.origin)
  })
})

//send a request to iframe1
const id = String(Math.random())
const request = {
  from: "main",
  to: "iframe1",
  type: "request",
  id: id,
  method: "someMethod",
  args: {...}
}
iframe1.contentWindow.postMessage(request, "*")
iframe1MessageDispatcher.waitForResponse(id).then(result => console.log(result))
```
npm package: @lsdsoftware/rate-limiter
Description: Basic rate limiter using the token bucket algorithm
Author: Hai Phan
Latest version: 1.1.0

# rate-limiter
Basic rate limiter using the token bucket algorithm

## usage
```typescript
import { makeRateLimiter } from "@lsdsoftware/rate-limiter"

const limiter = makeRateLimiter({tokensPerInterval: 5, interval: 60*1000})

function handleRequest(userId, req) {
  if (limiter.tryRemoveTokens(userId, 1)) return processRequest(req)
  else throw "Rate limit exceeded"
}
```
npm package: @lsdsoftware/s3-log-store
Description: Efficiently store and retrieve log-structured data (append only) in S3
Author: Hai Phan
Latest version: 1.1.0

# s3-log-store
Use S3 as log-structured store for append-only data streams such as conversation chat logs.

Log entries are JSON-ified and appended to files in a work directory.

Log files are periodically synced to an S3 bucket, broken up into chunks of preset size, gzipped.

Entries are retrievable in reverse order, given offset and limit.

Consumers can subscribe to streams to get notification of new entries.

```typescript
import { makeLogStore } from '@lsdsoftware/s3-log-store

const logStore = makeLogStore<T>({
  workDirConfig: {
    dirPath: string,
    syncInterval: number,
    chunkSize: number,
    inactiveTtlDays: number
  },
  s3StoreConfig: {
    clientConfig: S3ClientConfig,
    bucket: string,
    folder: string
  },
  retrievalCacheConfig: {
    cacheFolder: string,
    cleanupInterval: number
    makeAccessTracker(): {
      notifyAccess(): void
      isPurgeable(): boolean
    }
  }
})

logStore.append(streamId: string, data: T): Promise<void>
logStore.retrieve(streamId: string, offset: number, limit: number): Promise<T[]>
logStore.subscribe(streamId: string): rxjs.Observable<T>
```

`streamId` must be filename safe.

`inactiveTtlDays` specifies the number of days of inactivity (no new entries) before the a stream is considered inactive and its data purged from the local working dataset.

The _retrievalCache_ is a filesystem cache for objects retrieved from S3. Entries are purged according to policy set by caller-supplied access trackers.
npm package: @lsdsoftware/simple-cache
Description: Memory, disk, and S3 cache implementations with simple TTL
Author: Hai Phan
Latest version: 3.2.0

# simple-cache
Memory, disk, and S3 cache implementations with simple TTL.  Cache keys can be any object but must have a valid `toString()`.

For use with [multilayer-async-cache-builder](https://github.com/ken107/multilayer-async-cache-builder)

## Install
```
npm i ssh://github.com/ken107/simple-cache
```

## Example
Create a 3-layer cache:

Layer | Type   | Info
------|--------|---------------------------------------------
1     | Memory | ttl: 60 seconds, cleanupInterval: 60 seconds
2     | Disk   | ttl: 1 hour, cleanupInterval: 15 minutes
3     | S3     | ttl: (use bucket lifecycle rules)

```typescript
import { Fetch } from "multilayer-async-cache-builder"
import { MemCache, DiskCache, S3Cache } from "simple-cache"

const s3: AWS.S3;
const fetchItem: (id: string) => Promise<{data: Buffer, metadata: any}> = //define your fetch function

const getItem = new Fetch(fetchItem)
  .cache(new S3Cache(s3, "my-bucket"))
  .cache(new DiskCache("path/to/cache/folder", ms("1 hour"), ms("15 minutes")))
  .cache(new MemCache(ms("1 minute"), ms("1 minute")))
  .dedupe()

//use
getItem("item-id").then(useItem);
```
npm package: @lsdsoftware/state-machine
Description: Make implementing state machines less error prone
Author: Hai Phan
Latest version: 1.3.0

# state-machine
Make implementing state machines less error prone

# Usage
```typescript
import { makeStateMachine } from "@lsdsoftware/state-machine"

const sm = makeStateMachine({
  IDLE: {
    startIt() {
      //do something
      return "BUSY"
    }
  },
  BUSY: {
    stopIt() {
      //stop doing it
      return "IDLE"
    },
    stopAfterDelay() {
      return "STOPPING"
    }
  },
  STOPPING: {
    onTransitionIn(this: any) {
      //do some clean up
      this.timer = setTimeout(() => sm.trigger("onDone"), 3000)
    },
    onDone() {
      return "IDLE"
    },
    stopIt() {
      console.log("Already stopping, be patient!")
      //return void to stay in same state
    },
    forceIt(this: any) {
      clearTimeout(this.timer)
      return "IDLE"
    }
  }
})

sm.trigger("startIt")
sm.getState()   //BUSY
```
npm package: @lsdsoftware/utils
Description: Useful JavaScript utilities
Author: Hai Phan
Latest version: 2.0.1

# Useful JavaScript utilities


### Line Reader
Split text into lines

```typescript
import { makeLineReader } from "@lsdsoftware/utils"

myStream.pipe(makeLineReader(line => console.log(line)))
```


### Semaphore
Control concurrent access to resources

```typescript
import { makeSemaphore } from "@lsdsoftware/utils"

const semaphore = makeSemaphore(3)

const result = await semaphore.runTask(async () => {
  //use the limited resource
})
```


### Connect Socket
Observable wrapper for net.connect (see connect-socket.test.ts for usage)


### Spawn Child
Observable wrapper for child_process.spawn (see spawn-child.test.ts for usage)