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 🙏

© 2024 – Pkg Stats / Ryan Hefner

stringtemplate4ts

v1.0.1

Published

A TypeScript port of the Java StringTemplate 4 library

Downloads

32

Readme

GitHub Workflow Status (with event) Weekly Downloads npm version

Introduction

This repository contains a TypeScript port of the StringTemplate 4 template engine. It's released under the BSD license, like the original code, plus some additional code, which is released under the MIT license. These are:

  • Testing infrastructure code (decorators, JUnit wrappers, configuration and spec files)
  • A MurmurHash implementation used by the HashMap class.
  • The HashMap class.

ST4TS (StringTemplate4TypeScript) is a template engine for generating source code, web pages, emails, or any other formatted text output. ST4TS is particularly good at multi-targeted code generators, multiple site skins, and internationalization/localization.

The main website for the original ST implementation is:

https://www.stringtemplate.org

Its distinguishing characteristic is that it strictly enforces model-view separation, unlike other engines. See this document

The documentation is here

Per the BSD license in LICENSE.txt, this software is not guaranteed to work and might even destroy all life on this planet.

Known Differences

The port closely resembles the original. Luckily, Java and TypeScript share many similarities, allowing for the implementation of even esoteric language features such as runtime method access and invocation using string names (also known as reflection). However, there are a few differences, which are listed below:

  • Importing modules is different in both languages and can be challenging when dealing with circular dependencies. To avoid these dependencies, interfaces and factory methods have been defined for certain classes that refer to each other. This should not impose any restrictions for normal usage.
  • Formatting numbers with arbitrary format strings and locale support is not available. We can either have locale aware formatting using the standard toLocaleString method or we can have a custom format string pattern, not both. I decided for the latter (which uses the fast-printf library). Once I have found a library which supports both (such as luxon for date and time), this can be improved.

Installation

Run

npm i stringtemplate4ts

Or use your preferred package manager.

Building from Source

The source is at github.com:

https://github.com/mike-lischke/stringtemplate4ts

Check the repository out and run

npm run build

in the project root.

Running Unit Tests

Running the tests is equally simple. Just do:

npm run test

in the project root.

Release Notes

1.0.0 - 1.0.1

  • Initial release.
  • Some minor fixes.