tagged-template-permutations
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

Permutations - Tagged Template Literal

A utility to generate permutations and combinations from template literal expressions. Useful for generating a list of phrases or keywords with varying parts.

Installation

To install tagged-template-permutations, use npm:

npm install tagged-template-permutations

Or using yarn:

yarn add tagged-template-permutations

Usage

Import permutations in your TypeScript or JavaScript project:

import { permutations } from 'tagged-template-permutations'

const roles: string[] = ['Founder', 'Builder'];
const types: string[] = ['Startup', 'Nonprofit'];

const results = permutations`${roles} of a ${types}`;
console.log(results);
// Output: ['Founder of a Startup', 'Founder of a Nonprofit', 'Builder of a Startup', 'Builder of a Nonprofit']

API Reference

permutations`<template literal>`

Generates a list of permutations based on the provided template literal.

  • Template literals may contain arrays or strings.
  • The function returns an array of strings with all unique permutations. Contributing

We welcome contributions to the permutations package.

License

This project is licensed under the MIT License.

Support

If you have any questions or issues, please open an issue on the GitHub repository issue tracker.

Package Sidebar

Install

npm i tagged-template-permutations

Weekly Downloads

2

Version

0.1.4

License

MIT

Unpacked Size

19.2 kB

Total Files

8

Last publish

Collaborators

  • nathanclevenger