# alias8n

> A simple tool to replace aliases in text files

Latest version **1.0.1** (published 2022-05-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install alias8n
pnpm add alias8n
yarn add alias8n
bun add alias8n
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-05-08 |
| First published | 2022-04-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | 1.0.0 |
| Maintainers | saref111 |
| Keywords | alias, text, file, replace, alias8n, aliasolization |

## Links

- npm: https://www.npmjs.com/package/alias8n
- npm.io page: https://npm.io/package/alias8n

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2022-05-08
- 1.0.0 — 2022-04-01

## README

# Alias8n a.k.a Aliasolization

A simple tool to replace aliases in text files


## Installation 

    npm i alias8n 

## Using

Start the program:

    import alias8n from 'alias8n';
    
    const config = {
        ctxPath: "./ctx.json",
        source: "./index.html",
        dest: "./index-aliased.html",
    } /* These are default values */
    
    alias8n(config);
Alias8n has several ways to replace aliases with its values. 

+  ### Default
#### ctx.json
    {
        "hello": "Hello World!"
    }
#### index.html
    <p>a(:hello:)</p>
#### output.html 
    <p>Hello World!</p>
+  ### Templates
#### ctx.json
    {
        "hello-template": "<1>, <2>!"
    }
#### index.html
    <p>a(:hello-template, Hello, World:)</p>
#### output.html 
    <p>Hello World!</p>
+  ### Arrays *(can contain only strings)*
#### ctx.json
    {
        "hello-array": ["Hello, World!", "Hello, Heaven!", "Hello, Hell!"]
    }
#### index.html
    <p>a(:hello-array)</p>
    <p>a(:hello-array)</p>
    <p>a(:hello-array)</p>
#### output.html 
    <p>Hello World!</p>
    <p>Hello Heaven!</p>
    <p>Hello Hell!</p>
+  ### Objects and nesting
#### ctx.json
    {
        "hello-obj": {
            "hello": "Hello,",
            "nested-object": {
                "world": "World!"
            },  
            "nested-array": ["Hello, World!", "Hello, Heaven!", "Hello, Hell!"]
        }
    }
#### index.html

    <p>a(:hello-obj.hello:) a(hello-obj.nested-obj.world)</p>
    
    <ul>
        <li>a(:hello-obj.nested-array:)</li>
        <li>a(:hello-obj.nested-array:)</li>
        <li>a(:hello-obj.nested-array:)</li>
    </ul>


#### output.html 
    <p>Hello World!</p>
    
    <ul>
        <li>Hello World!</li>
        <li>Hello Heaven!</li>
        <li>Hello Hell!</li>
    </ul>

---
_Source: https://npm.io/package/alias8n · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
