Skip to content

🐌 Zing is a C# style String formatter for JavaScript that empowers Strings with positional arguments - composite formatting. πŸš€

License

Notifications You must be signed in to change notification settings

igorskyflyer/npm-zing

Repository files navigation

Icon of Zing

Zing


🐌 Zing is a C# style String formatter for JavaScript that empowers Strings with positional arguments - composite formatting. πŸš€



πŸ“ƒ Table of Contents



πŸ€– Features

  • ⚑ Quick formatting - Drop in {0}, {1} placeholders and swap them instantly
  • πŸ›  C#-style syntax - Familiar composite formatting for .NET devs in JS/TS
  • 🎯 Positional arguments - Control exactly where each value lands
  • πŸ›‘ Safe fallback - Leaves unknown placeholders untouched
  • 🧩 Lightweight utility - No dependencies, minimal footprint
  • πŸ”„ Multi-replace - Handles all matching placeholders in one pass
  • πŸ“œ TypeScript-ready - Strong typing for cleaner code
  • 🌍 Cross-platform - Works in browser and Node environments

ℹ️ NOTE

More information about composite formatting.



πŸ•΅πŸΌ Usage

Install it by executing any of the following, depending on your preferred package manager:

pnpm add @igorskyflyer/zing
yarn add @igorskyflyer/zing
npm i @igorskyflyer/zing


🀹🏼 API

zing(value: string, ...args: any[]): string

Formats the provided string in a C# style format, i.e. adds the ability to use positional arguments, like seen with String.Format in C#.

value: string => The string to process that support positional parameters, i.e. zing('Hello {0} {1}', 'Igor', 'Dimitrijević') would output Hello Igor Dimitrijević.

The returned value is always a string.



πŸ“ Changelog

πŸ“‘ The changelog is available here, CHANGELOG.md.



πŸͺͺ License

Licensed under the MIT license which is available here, MIT license.



πŸ’– Support

I work hard for every project, including this one and your support means a lot to me!
Consider buying me a coffee. β˜•

Donate to igorskyflyer

Thank you for supporting my efforts! πŸ™πŸ˜Š


🧬 Related

@igorskyflyer/recursive-readdir

πŸ“– Provides recursive readdir() and readdirSync() functions. πŸ“


@igorskyflyer/regkeys

πŸ“š An npm package for fetching Windows registry keys. πŸ—


@igorskyflyer/jmap

πŸ•ΆοΈ Reads a JSON file into a Map. 🌻


@igorskyflyer/unc-path

πŸ₯½ Provides ways of parsing UNC paths and checking whether they are valid. 🎱


@igorskyflyer/scrollend-polyfill

πŸ›΄ A performant and light (< 1KB) JavaScript polyfill for the scrollend Event. ⛸️




πŸ‘¨πŸ»β€πŸ’» Author

Created by Igor Dimitrijević (@igorskyflyer).

About

🐌 Zing is a C# style String formatter for JavaScript that empowers Strings with positional arguments - composite formatting. πŸš€

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project