npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tulisix

v1.0.0

Published

Transform text node into any format imaginable.

Downloads

12

Readme

Tulisix

Transform text nodes into any format imaginable.

Overview

Tulisix lets you transform text nodes into specific formats based on rules you define.

  • Rule-based transformation
  • Supports dynamic variables
  • Function-based output for advanced logic
  • Automatic HTML escaping (XSS-safe by default)

Installation & Usage

Installation

Browser

Include via CDN:

<script src="https://cdn.jsdelivr.net/gh/rezzvy/tulisix@465b13b/dist/tulisix.min.js"></script>
const tulisix = new Tulisix();

Node

Install via npm:

npm install tulisix
import Tulisix from "tulisix";
const tulisix = new Tulisix();

Usage

<div id="app">Hello Reza</div>
tulisix.addRule({
  from: "Hello {name}",
  to: "<strong>Hello {name}</strong>",
});

tulisix.replace("#app");

Examples

Multiple Patterns

<p class="text">Hi Reza</p>
const tulisix = new Tulisix();

tulisix.addRule({
  from: ["Hi {name}", "Hello {name}"],
  to: "<b>{name}</b>",
});

tulisix.replace(".text");

Dynamic Output (Function)

<p class="price">Price: 100</p>
const tulisix = new Tulisix();

tulisix.addRule({
  from: "Price: {value}",
  to: (safe, match, raw) => {
    return `<span>$${Number(raw.value).toFixed(2)}</span>`;
  },
});

tulisix.replace(".price");

Case Insensitive

<p class="text">hello Reza</p>
const tulisix = new Tulisix();

tulisix.addRule({
  from: "hello {name}",
  to: "<i>{name}</i>",
  caseSensitive: false,
});

tulisix.replace(".text");

Escaping Curly Braces

<p class="text">{not a variable}</p>
const tulisix = new Tulisix();

tulisix.addRule({
  from: "\\{not a variable\\}",
  to: "<span>literal</span>",
});

tulisix.replace(".text");

Multiple Rules

<p class="text">**bold** and *italic*</p>
const tulisix = new Tulisix();

tulisix.addRule([
  {
    from: "**{text}**",
    to: "<strong>{text}</strong>",
  },
  {
    from: "*{text}*",
    to: "<em>{text}</em>",
  },
]);

tulisix.replace(".text");

Documentation

API Reference

addRule(param)

Register one or more transformation rules.

| Parameter | Type | Description | | :-------- | :-------------------------- | :------------------------------------ | | param | Object | Array<Object> | Rule object or array of rule objects. |

Rule Object Structure

| Property | Type | Required | Default | Description | | :-------------- | :-------------------------- | :------- | :------ | :-------------------------------------- | | from | String | Array<String> | Yes | - | Pattern(s) with optional {variables}. | | to | String | Function | Yes | - | Replacement string or function. | | caseSensitive | Boolean | No | true | Enable/disable case-sensitive matching. |

to Function Arguments

Used when to is a function:

| Argument | Type | Description | | :--------- | :------- | :---------------------------------------- | | safeVars | Object | Escaped variables (safe for HTML output). | | match | Array | Result from RegExp.exec(). | | rawVars | Object | Original (unescaped) variable values. |

replace(target)

Apply all registered rules to the target.

| Parameter | Type | Description | | :-------- | :------------------------------------------------------ | :------------------------------------------------- | | target | String | Element | NodeList | Array<Element> | Selector or collection of DOM elements to process. |

Limitations

Text nodes only

Tulisix only processes text nodes. It does not parse or transform HTML attributes or element structures. Example: <div title="Hello Reza"> will NOT be transformed.

No cross-node matching

Patterns must exist within a single text node. Text split across multiple elements will not match.

Example:

<span>Hello</span> <span>Reza</span>

Will NOT match Hello {name}.

HTML output is not sanitized

Only variables are automatically escaped. If you return raw HTML in to, you are responsible for ensuring it is safe.

Greedy / ambiguous patterns

Patterns using {variables} may behave unexpectedly if the structure is ambiguous.

Example:

"{a} {b}"

may produce unintended matches depending on content.

Order matters

Rules are applied sequentially. Earlier rules can affect later matches.

Not a full template engine

Tulisix is designed for lightweight text transformation, not full HTML templating or parsing.

Contributing

There's always room for improvement. Feel free to contribute!

Licensing

The project is licensed under the MIT License. Check the license file for more details.