open-index/open-npm huggingface dataset:
npm package: @initics/tsm
Description: Tiny state machine
Author: initics
Latest version: 1.0.2

# tsm - Tiny state machine
Manages state transitions and validates transitions before actually changing the state.

## Examples
Lets say we want to implement a simple music player, that can be started and stopped.

Possible transitions are:
- start: `ready` -> `playing`
- stop: `playing` -> `stopped`

```javascript
const { StateMachine } = require('@initics/tsm');

// Define the initial state as well as possible transitions
const sm = new StateMachine({
    initial: 'ready',
    transitions: [
        { from: 'ready', to: 'playing' },
        { from: 'playing', to: 'stopped' }
    ]
});

console.log('initial state:', sm.state);

// start playing
sm.transition('playing');
console.log('start:', sm.state);

// stop playing
sm.transition('stopped');
console.log('final state:', sm.state);
```

Invalid transitions will throw an error:
```javascript
const { StateMachine } = require('@initics/tsm');

const sm = new StateMachine({
    initial: 'ready',
    transitions: [
        { from: 'ready', to: 'playing' },
        { from: 'playing', to: 'stopped' }
    ]
});

// throws: Invalid trasition from "ready" to "stopped"
sm.transition('stopped');
```

Lets implement a more "sophisticated" music player, that can not only be started and stopped, but also paused and resumed.

Possible transitions are:
- start: `ready` -> `playing`
- pause: `playing` -> `paused`
- stop: `playing` -> `stopped`
- resume: `paused` -> `playing`
- stop: `paused` -> `stopped`

```javascript
const { StateMachine } = require('@initics/tsm');

const sm = new StateMachine({
    initial: 'ready',
    transitions: [
        { from: [ 'ready', 'paused' ], to: 'playing' },
        { from: 'playing', to: 'paused' },
        { from: [ 'playing', 'paused' ], to: 'stopped' }
    ]
});

console.log('initial state:', sm.state);

sm.transition('playing');
console.log('start:', sm.state);

sm.transition('paused');
console.log('pause:', sm.state);

sm.transition('playing');
console.log('resume:', sm.state);

sm.transition('stopped');
console.log('final state:', sm.state);

```
npm package: @initred/nuxt3-dayjs
Description: [dayjs](https://day.js.org/) module for [nuxt v3](https://nuxt.com/)
Latest version: 1.0.3

# Nuxt3 dayjs Module

[dayjs](https://day.js.org/) module for [nuxt v3](https://nuxt.com/)

defaults config
```ts
export default defineNuxtModule<ModuleOptions>({
  defaults: {
    locales: [],
    defaultLocale: 'en',
    plugins: [
      'utc',
      'timezone'
    ],
    defaultTimezone: null
  }
})
```

How to use
```ts
export default defineNuxtConfig({
    modules: [
        '@initred/nuxt3-dayjs',
    ],
    dayjs: {
        locales: ['en', 'ko'],
        defaultLocale: 'ko',
        defaultTimezone: 'America/New_York',
        plugins: [
            'relativeTime',
            'isoWeek',
            'utc',
            'weekday',
            'isToday',
            'isSameOrBefore',
            'isSameOrAfter',
            'localizedFormat',
            'timezone',
            'updateLocale',
            'localeData',
        ],
    },   
],
```


## Development

- Run `npm run dev:prepare` to generate type stubs.
- Use `npm run dev` to start [playground](./playground) in development mode.
npm package: @initru/ngx-ion-simple-mask
Description: A simple angular/ionic input mask(Tested in Ionic 4)
Latest version: 0.9.3

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/rafaelcorradini/ngx-ion-simple-mask/master/LICENSE)
[![Build Status](https://travis-ci.com/rafaelcorradini/ngx-ion-simple-mask.svg?branch=master)](https://travis-ci.com/rafaelcorradini/ngx-ion-simple-mask)
# ngx-ion-simple-Mask

Input mask for Angular/Ionic (Tested with Ionic 4)

## <a name="1"></a> Installing

```bash
$ npm install --save ngx-ion-simple-mask
```

## <a name="2"></a> Usage

Import ngx-ion-simple-mask module in Angular app.
```typescript
import { SimpleMaskModule } from 'ngx-ion-simple-mask'

@NgModule({
  imports: [
    SimpleMaskModule
  ]
})
```

Or import the directive/pipe separately
```typescript
import { SimpleMaskDirective, SimpleMaskPipe } from 'ngx-ion-simple-mask'

@NgModule({
  declarations: [
    SimpleMaskDirective,
    SimpleMaskPipe
  ]
})
```

### Ionic

ionic usage example:
```html
<ion-input simpleMask="999.999.999-99" [clearIfNotMatch]="true"></ion-input>
```

### Angular

Angular usage example:
```html
<input simpleMask="999.999.999-99" [clearIfNotMatch]="true">
```

### Form Control/NgModel

The libray works with Form Control and ngModel:
```html
<input simpleMask="999.999.999-99" [formControl]="formControl">
```

```html
<input simpleMask="999.999.999-99" [(ngModel)]="value">
```

### Pipe

#### example
```html
<p>{{ '123321123-12' | simpleMask:'999.999.999-99' }}<p>
```
output: 
```html
<p>123.321.123-12</p>
```

#### example with add patterns
```html
<p>{{ 'asd-123' | simpleMask:'aaa-II':{'I': '[0-9]' } }}<p>
```
output: 
```html
<p>asd-12</p>
```

#### example with new patterns(ignoring old patterns)
```html
<p>{{ '123-bddd' | simpleMask:'III-aaa':{'I': '[0-9]' }:true }}<p>
```
output: 
```html
<p>123-aaa</p>
```

## <a name="3"></a>Patterns
### Default patterns:

```typescript
patterns = {
    '9': new RegExp('[0-9]'),
    'a': new RegExp('[a-z]'),
    'A': new RegExp('[A-Z]'),
    'x': new RegExp('[a-zA-Z]'),
    '*': new RegExp('[a-zA-Z0-9]'),
    '~': new RegExp('[-\+]')
};
```

| pattern | meaning |
|------|---------|
| **9** | digits (0-9) |
| **a** | lowercase letters (a-z) |
| **A** | uppercase letters (A-Z) |
| **x** | letters uppercase or lowercase (a-z, A-Z) |
|  **~** | - or + |
| **\*** | letters or digits (a-z, A-Z, 0-9) |
|  **\\** | cancel next pattern effect |

#### Examples

| mask | example |
| ------- | ------- |
| 999.999.aaa | 113.123.asd |
| (AA) 999 | (AS) 123 |
| 999\\\~ | 999~ |

### Set new patterns

The set strings will be used as regex
```html
<input
    simpleMask="IIIxxx"
    [newPatterns]="{ 'I': '[a-z]', 'x': '[0-9]' }">
```
example of input: abc123

### Add patterns

The set strings will be used as regex
```html
<input simpleMask="~III999" [addPatterns]="{ 'I': '[a-z]' }">
```
example of input: +abc123

## angular-library-starter
The project was built with [angular-library-starter](https://github.com/robisim74/angular-library-starter/).

## License
MIT
npm package: @initx-plugin/core
Description: core module for initx plugins
Latest version: 0.3.5

<h1 align="center">initx ⚙️</h1>

<p align="center"><code>initx</code> A more convenient scripting engine</p>

<pre align="center">npx <b>initx &lt;something&gt;</b></pre>

## @initx-plugin/core

Core module for `initx` plugins.

## Documentation

[initx](https://github.com/initx-collective/initx)
npm package: @initx-plugin/cp
Description: initx plugin, copy some text to clipboard
Author: imba97
Latest version: 0.0.24

<h1 align="center">initx ⚙️</h1>

<p align="center"><code>initx</code> A more convenient scripting engine</p>

<pre align="center">npx <b>initx &lt;something&gt;</b></pre>

## @initx-plugin/cp

Copy plugin for `initx`

## Usage

```bash
npx initx plugin add cp
```

Copy some text to clipboard

### Current Working Directory

```bash
npx initx cp cwd
```

### SSH Public Key

```bash
npx initx cp ssh
```

### GPG Public Key

```bash
npx initx cp gpg
```

## Documentation

[initx](https://github.com/initx-collective/initx)
npm package: @initx-plugin/git
Description: initx plugin, git operations
Author: imba97
Latest version: 0.0.19

<h1 align="center">initx ⚙️</h1>

<p align="center"><code>initx</code> A more convenient scripting engine</p>

<pre align="center">npx <b>initx &lt;something&gt;</b></pre>

## @initx-plugin/git

Git plugin for `initx`

## Usage

```bash
npm install @initx-plugin/git -g
```

### Git Repository

Create a new repository or modify the remote repository address in the current directory

```bash
npx initx git@github.com:user/repository.git
```

### Git Branch

Specify a branch name

```bash
npx initx git@github.com:user/repository.git main
```

### Git User

Set git username and email

```bash
npx initx user mail@example.com your_name
```

### Git GPG

```bash
# npx initx gpg [true|false]
npx initx gpg true
```

Select `Enable or disable GPG signing for git commits`, Set git commit signature

If true, includes setting the Git GPG Key

### Git GPG Key

```bash
npx initx gpg
```

Select `Set GPG key for git commits`

## Documentation

[initx](https://github.com/initx-collective/initx)
npm package: @initx-plugin/gpg
Description: initx plugin, gpg key management
Author: imba97
Latest version: 0.0.21

<h1 align="center">initx ⚙️</h1>

<p align="center"><code>initx</code> A more convenient scripting engine</p>

<pre align="center">npx <b>initx &lt;something&gt;</b></pre>

## @initx-plugin/gpg

Gpg plugin for `initx`

## Usage

```bash
npm install @initx-plugin/gpg -g
```

Select `GPG key management`

### GPG import

Automatically read files ending with `publich.key` and `private.key` in the current directory

```bash
npx initx gpg import
```

### GPG export

Export the public key and private key to the current directory

```bash
# npx initx gpg export [filename]?
npx initx gpg export home
```

`home_public.key` and `home_private.key` will be created in the current directory

### GPG delete

Delete the public key and private key

```bash
# npx initx gpg delete [public|private]?
npx initx gpg delete
```

## Documentation

[initx](https://github.com/initx-collective/initx)
npm package: @initx-plugin/manager
Description: initx plugin manager
Author: imba97
Latest version: 0.5.0

## @initx-plugin/manager

`initx` plugin manager

## Usage

```bash
npx initx plugin <command>
```

This command will automatically install `@initx-plugin/manager` if not already installed.

### List

```bash
npx initx plugin list
```

List all installed plugins

### Add

```bash
# npx initx plugin add <plugin-name>
npx initx plugin add git

# Skip search and install directly
npx initx plugin add @initx-plugin/git --raw
```

This command will search and install `@initx-plugin/git` or `initx-plugin-git`

If there are multiple, let the user choose

**Options:**
- `--raw` - Skip search and install with the exact name provided

### Update

```bash
npx initx plugin update
```

Detect the versions of all plugins and update the plugins that need to be updated

Automatically filter local development plugins

### Remove

```bash
# npx initx plugin remove <plugin-name>
npx initx plugin remove git
```

This command will remove `@initx-plugin/git` or `initx-plugin-git`

If there are multiple, let the user choose

## Documentation

[initx](https://github.com/initx-collective/initx)
npm package: @initx-plugin/pm
Description: project manager plugin for initx
Author: imba97
Latest version: 0.0.3

## @initx-plugin/pm

Project manager plugin for `initx`.

## Usage

install the plugin globally

```bash
npx initx plugin add pm
```

### Set project directory

```bash
npx initx pm add <name?> <path>
```

`name` is optional. If it is not provided, it defaults to `default`.

`path` can be a relative path or an absolute path.

```bash
# Add the current directory as a project directory
npx initx pm add .
# Add the parent directory as a project directory
npx initx pm add ..
# Add the directory D:/Projets as a project directory
npx initx pm add D:/projets
# Add the directory D:/my-projects with name
npx initx pm add frontend D:/projects-front
npx initx pm add backend D:/projects-backend
```

### List project directories

```bash
npx initx pm list
```

### Use project directory

```bash
npx initx pm use <name>
```

### Remove project directory

```bash
npx initx pm remove <name>
```

### Create a new project to the specified directory

```bash
npx initx pm create name/repo <as?>
```

Equivalent to run

```bash
cd <path>
git clone git@github.com:username/my-project.git as-name
```

## Documentation

[initx](https://github.com/initx-collective/initx)
npm package: @initx-plugin/utils
Description: A more convenient scripting engine
Latest version: 0.3.5

<h1 align="center">initx ⚙️</h1>

<p align="center"><code>initx</code> A more convenient scripting engine</p>

<pre align="center">npx <b>initx &lt;something&gt;</b></pre>

## @initx-plugin/utils

Utilities for `initx`

## Documentation

[initx](https://github.com/initx-collective/initx)
npm package: @iniz/core
Description: Iniz is a reactive state library. Try it out on our [website](https://iniz.netlify.app)!
Latest version: 0.8.0

# Iniz

Iniz is a reactive state library. Try it out on our [website](https://iniz.netlify.app)!

`npm i @iniz/core`

[![Build Status](https://img.shields.io/github/workflow/status/inizio/iniz/CI/main?style=flat&colorA=28282B&colorB=28282B)](https://github.com/inizio/iniz/actions?query=workflow%3ACI)
[![Test Coverage](https://img.shields.io/codecov/c/github/inizio/iniz/main?token=qiX91NsrLE&label=coverage&style=flat&colorA=28282B&colorB=28282B)](https://codecov.io/gh/IniZio/iniz)
[![Build Size](https://img.shields.io/bundlephobia/minzip/@iniz/core?label=bundle%20size&style=flat&colorA=28282B&colorB=28282B)](https://bundlephobia.com/package/@iniz/core)
[![Version](https://img.shields.io/npm/v/@iniz/core?style=flat&colorA=28282B&colorB=28282B)](https://www.npmjs.com/package/@iniz/core)
[![Downloads](https://img.shields.io/npm/dt/@iniz/core.svg?style=flat&colorA=28282B&colorB=28282B)](https://www.npmjs.com/package/@iniz/core)

- [Guide](#guide)
  - [Getting started](#getting-started)
    - [Create an atom](#create-an-atom)
    - [Mutate the atom value](#mutate-the-atom-value)
    - [Subscribe to atom](#subscribe-to-atom)

## Guide

### Getting started

#### Create an atom

Atom is the smallets unit of reactive state.

```ts
import { atom } from "@iniz/core";

const timer$ = atom(new Date());

// It can be a complex nested object/array as well...
const nestedCounter$ = atom({
  obj: {
    array: [{ count: 3 }],
    message: "Hello World",
  },
});
```

#### Mutate the atom value

Call the atom to read/write it.

```ts
timer$(); // Returns latest value e.g. `2019-08-31T00:00:00.000Z`

setInterval(() => {
  nestedCounter$().obj.array[0].count++;
  timer$(new Date());
  // Calling it as function also sets `value`
}, 1000);

// Later on...
timer$(); // Returns latest value e.g. `2022-08-31T00:00:00.000Z`
nestedCouner$().obj.array[0].count;
```

#### Subscribe to atom

Use `effect()` to subscribe to value change.

```ts
const dispose = effect(() => {
  console.log("Updated timer: ", timer$());
});

// Execute `dispose` to stop effect
dispose();
```

Use `computed()` to get calculated value from multiple atoms.

```ts
const timerAndCounter$ = computed(
  () => `Computed: '${nestedCounter$().obj.array[0]}' '${timer$()}'`
);

timerAndCounter$(); // Returns "Computed: 2022-08-31T00:00:00.000Z 4"
```
npm package: @iniz/preact
Description: Iniz is a reactive store library. Try it out on our [website](https://iniz.netlify.app)!
Latest version: 0.3.0

# Iniz

Iniz is a reactive store library. Try it out on our [website](https://iniz.netlify.app)!

`npm i @iniz/preact`

[![Build Status](https://img.shields.io/github/workflow/status/inizio/iniz/CI/main?style=flat&colorA=28282B&colorB=28282B)](https://github.com/inizio/iniz/actions?query=workflow%3ACI)
[![Test Coverage](https://img.shields.io/codecov/c/github/inizio/iniz/main?token=qiX91NsrLE&label=coverage&flag=react&style=flat&colorA=28282B&colorB=28282B)](https://codecov.io/gh/IniZio/iniz)
[![Build Size](https://img.shields.io/bundlephobia/minzip/@iniz/preact?label=bundle%20size&style=flat&colorA=28282B&colorB=28282B)](https://bundlephobia.com/package/@iniz/preact)
[![Version](https://img.shields.io/npm/v/@iniz/preact?style=flat&colorA=28282B&colorB=28282B)](https://www.npmjs.com/package/@iniz/preact)
[![Downloads](https://img.shields.io/npm/dt/@iniz/preact.svg?style=flat&colorA=28282B&colorB=28282B)](https://www.npmjs.com/package/@iniz/preact)

- [Guide](#guide)

## Guide

> `@iniz/preact` already re-exports `@iniz/core`, so don't need to install `@iniz/core` yourself

Simply use `atom()` values in components, they will re-render correctly with custom jsxImportSource.

```tsx
/** @jsxImportSource @iniz/preact */
import { useAtom, useComputed, useSideEffect } from "@iniz/preact";

function MessageInput() {
  // Equivalient to `atom()`
  const counter = useAtom(10);

  // Equivalent to `computed()`
  const computedCounter = useComputed(
    () => `Computed: ${nestedCounter$$().obj.message}`
  );

  // Equivalent to `effect()`
  // NOTE: You can also use `useEffect` with atoms actually
  useSideEffect(() => {
    console.log("[Latest message] ", computedCounter());
  });

  return (
    <div>
      <button onClick={() => counter(counter() + 1)}>{counter()}++</button>
    </div>
  );
}
```
npm package: @iniz/react
Description: Iniz is a reactive state library. Try it out on our [website](https://iniz.netlify.app)!
Latest version: 0.7.0

# Iniz

Iniz is a reactive state library. Try it out on our [website](https://iniz.netlify.app)!

`npm i @iniz/react`

[![Build Status](https://img.shields.io/github/workflow/status/inizio/iniz/CI/main?style=flat&colorA=28282B&colorB=28282B)](https://github.com/inizio/iniz/actions?query=workflow%3ACI)
[![Test Coverage](https://img.shields.io/codecov/c/github/inizio/iniz/main?token=qiX91NsrLE&label=coverage&flag=react&style=flat&colorA=28282B&colorB=28282B)](https://codecov.io/gh/IniZio/iniz)
[![Build Size](https://img.shields.io/bundlephobia/minzip/@iniz/react?label=bundle%20size&style=flat&colorA=28282B&colorB=28282B)](https://bundlephobia.com/package/@iniz/react)
[![Version](https://img.shields.io/npm/v/@iniz/react?style=flat&colorA=28282B&colorB=28282B)](https://www.npmjs.com/package/@iniz/react)
[![Downloads](https://img.shields.io/npm/dt/@iniz/react.svg?style=flat&colorA=28282B&colorB=28282B)](https://www.npmjs.com/package/@iniz/react)

- [Guide](#guide)

## Guide

> `@iniz/react` already re-exports `@iniz/core`, so don't need to install `@iniz/core` yourself

Simply use `atom()` values in components, they will re-render correctly thanks to [useSyncExternalStore](https://reactjs.org/docs/hooks-reference.html#usesyncexternalstore)

```tsx
import { useAtom, useComputed, useSideEffect } from "@iniz/react";

// The component won't re-render when `nestedCounter$().obj.array[0].count` is updated
function MessageInput() {
  // Equivalient to `atom()`
  const counter = useAtom(10);

  // Equivalent to `computed()`
  const computedCounter = useComputed(
    () => `Computed: ${nestedCounter$$().obj.message}`
  );

  // Equivalent to `effect()`
  // NOTE: You can also use `useEffect` with atoms actually
  useSideEffect(() => {
    console.log("[Latest message] ", computedCounter());
  });

  return (
    <div>
      <button onClick={() => counter(counter() + 1)}>{counter()}++</button>
      <input
        value={nestedCounter$().obj.message}
        onChange={(evt) => (nestedCounter$().obj.message = evt.target.value)}
      />
    </div>
  );
}
```