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

funcystr

v2.0.0

Published

A lightweight JavaScript library for processing strings with embedded functions.

Downloads

7

Readme

FuncyStr Library

Node.js CI License: MIT

"Buy Me A Coffee"

FuncyStr is a lightweight JavaScript library designed to process strings with embedded functions. It allows dynamic string resolution based on provided parameters, supporting nested and multiple function calls within a single string.

Features

  • Dynamic String Resolution: Replace placeholders in strings with dynamic values based on provided parameters.
  • Custom Functions: Define your own functions to handle specific placeholders.
  • Nested Functions: Supports resolving functions within other functions.
  • Graceful Handling: Leaves unresolved placeholders intact if no matching function is defined.

Installation

Install FuncyStr via npm:

npm install funcystr --save-dev

Usage

Basic Example

import FuncyStr from 'funcystr';

const fstr = await new FuncyStr({
    PRONOUN: (params, he, she, they) => params.pronoun === 'he' ? he : params.pronoun === 'she' ? she : they,
    PLURAL: (params, one, plural) => (params.plural ? plural : one),
});

const result = await fstr.process("{{He is|She is|They are}} very welcome to join us.", { pronoun: 'he' });
console.log(result); // Output: "He is very welcome to join us."

Nested Functions

const input = "{{PLURAL|This is|These are}} lovely {{PRONOUN|{{PLURAL|man|men}}|{{PLURAL|woman|women}}|{{PLURAL|person|people}}}}.";

const result = await fstr.process(input, { pronoun: 'they', plural: true });
console.log(result); // Output: "These are lovely people."

Handling Missing Functions

const result = await fstr.process("This is a {{UNKNOWN|arg1|arg2}}.", {});
console.log(result); // Output: "This is a {{UNKNOWN|arg1|arg2}}."

API

new FuncyStr(functions)

Creates a new FuncyStr instance.

  • functions: An object where keys are function names and values are the corresponding resolver functions.

process(input, params)

Processes a string and resolves all placeholders.

  • input: The string containing placeholders to resolve.
  • params: An object containing parameters used by the resolver functions.

Testing

Run the test suite to ensure everything is working as expected:

npm run test

License

This project is licensed under the MIT License by Moriel Schottlender. Credit is appreciated.

If you want to support this project, please feel free to submit pull requests, add issues, or support me by buying me coffee.