open-index/open-npm huggingface dataset:
npm package: @jondotsoy/unindent
Description: remove origin's indentation
Latest version: 0.1.1

# unindent

Remove origin's indentation.

**Samples:**

```ts
// Remove indentation from a text with 2 spaces.
const script = unindent`
  param:
    second_params: 3
`; // => "param:\n  second_params: 3\n"

// Change indentation to 4 spaces
const script = unindent(4)`
  param:
    second_params: 3
`; // => "    param:\n      second_params: 3\n"
```

## Syntax

```ts
unindent`text multiline`; // => string
unindent(indentSize)`text multiline`; // => string

unindent(textMultiline); // => string
unindent(indentSize, textMultiline); // => string
```

**Parameters**

- `text multiline`: Can be used the `unindent` function as a tagged template.
- `indentSize` (number): define the new indentation to the text.
- `textMultiline` (string): text to remove indentation

**Return value**

A string formatted.
npm package: @jondotsoy/vault
Description: [![Try @jondotsoy/vault on RunKit](https://badge.runkitcdn.com/@jondotsoy/vault.svg)](https://npm.runkit.com/@jondotsoy/vault)
Author: Jonathan Delgado
Latest version: 0.2.5

# 📦🔐Vault

[![Try @jondotsoy/vault on RunKit](https://badge.runkitcdn.com/@jondotsoy/vault.svg)](https://npm.runkit.com/@jondotsoy/vault)

Protect your data with a json crypto storage. This is a opensource solution to shared configurations on cloud.

**Sample**

```ts
import { Vault, RemoteStore } from "@jondotsoy/vault"

const vaultPublicKey = process.env.VAULT_PUBLICKEY
const vaultRemoteId = process.env.VAULT_REMOTE_ID
const vaultRemoteReadKey = process.env.VAULT_REMOTE_READKEY

const vault = await Vault.create<{ db: { uri: string } }>({
  store: new RemoteStore({
    id: vaultRemoteId,
    readkey: vaultRemoteReadKey,
  }),
  publicKey: vaultPublicKey,
})

const configs = await vault.readConfigs()

const mongoUri = configs.db.uri
// ...
```

## Quick starter

You can start using vault in 2 steps.

1. Create your first vault using `npx @jondotsoy/vault vault create` in your terminal. This command configures and creates the vault in your machine, accessible from `$HOME/.vault`.
2. Configure the vault in your project installing vault using `npm i @jondotsoy/vault` and copy the next code in your source.

```ts
import { Vault, RemoteStore } from "@jondotsoy/vault"

const vaultPublicKey = process.env.VAULT_PUBLICKEY
const vaultRemoteId = process.env.VAULT_REMOTE_ID
const vaultRemoteReadKey = process.env.VAULT_REMOTE_READKEY

const vaultPromise = Vault.create({
  store: new RemoteStore({
    id: vaultRemoteId,
    readkey: vaultRemoteReadKey,
  }),
  publicKey: vaultPublicKey,
})

export const getVault = () => vaultPromise
```

You can obtain the environment values with `npx @jondotsoy/vault vault info`. While you be are the manager vault, you will use that command without problems.

> Remember this is only a sample that uses a singleton instance to read the vault. You can use your own implementation for your project.

## How to use (API)

**Install with npm**

```sh
npm i @jondotsoy/vault
```

and require the vault

```ts
import { Vault, FileStore } from "@jondotsoy/vault"
```

```ts
const vault = await Vault.create({
  store: new FileStore({ pathStore: "FILEPATH" }),
  publicKey: publicKey,
})

const configs = await vault.readConfigs() // [MyConfigs]
```

### Create a Vault

```ts
const vault = await Vault.create({
  store: new FileStore({ pathStore: "FILEPATH" }),
  modulusLength: 512,
})

const { publicKey, privateKey } = vault.export()

publicKey // MEgCQQC8QHhm1a3TEOO502VTldRTrI9UQ...
privateKey // MIIBOwIBAAJBALxAeGbVrdMQ47nTZVOV1FOsj1RDuKCnud...

await vault.saveConfigs(MyConfigs)

// $ cat FILEPATH
// lWM4ZtHZE...
```

### Use a Vault

```ts
const vault = await Vault.create({
  store: new FileStore({ pathStore: "FILEPATH" }),
  publicKey: publicKey,
})

await vault.readConfigs() // [MyConfigs]
```

## Remote Store

Create, share
npm package: @jondotsoy/wrappererrorasyncfunction
Description: Omit the `promise.catch(fn)` expression.
Author: Jonathan Delgado
Latest version: 1.0.1

# Wrapper Error Async Function

Wrapper to show error on an async function immediately invoked. This omit the `promise.catch(fn)` expression.

Example with using setinterval.

**without @jondotsoy/wrapperErrorAsyncFunction**

```javascript
async function sayError () {
  throw new Error('Hola :D')
}

setinterval(sayError, 10000)
sayError()
// (node:8612) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: hola :D
// (node:8612) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
```

**with @jondotsoy/wrappererrorasyncfunction**

```javascript
import wrapperErrorAsyncFunction from '@jondotsoy/wrappererrorasyncfunction'

const sayError = wrapperErrorAsyncFunction(async function sayError () {
  throw new Error('Hola :D')
})

setinterval(sayError, 10000)
sayError()
// Error: hola :D
//     at wrapperErrorAsyncFunction (index.js:106:9)
//     at args (index.js:23:77)
//     at Object.<anonymous> (index.js:109:1)
//     at Module._compile (module.js:573:30)
//     at Module._compile (node_modules\pirates\lib\index.js:88:24)
//     at Module._extensions..js (module.js:584:10)
//     at Object.newLoader [as .js] (node_modules\pirates\lib\index.js:93:7)
//     at Module.load (module.js:507:32)
//     at tryModuleLoad (module.js:470:12)
//     at Function.Module._load (module.js:462:3)
//     at Function.Module.runMain (module.js:609:10)
//     at startup (bootstrap_node.js:158:16)
//     at bootstrap_node.js:578:3
```