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

banana-prompts

v1767513.690.29

Published

Professional integration for https://bananaproai.com/banana-prompts/

Readme

banana-prompts

A JavaScript library to streamline prompt creation and management for AI models, enhancing your development workflow. It provides utility functions for constructing, validating, and formatting prompts.

Installation

bash npm install banana-prompts

Usage Examples

Here are a few examples demonstrating how to use banana-prompts in your JavaScript/Node.js applications:

1. Simple Prompt Generation: javascript const { generatePrompt } = require('banana-prompts');

const topic = "space exploration"; const style = "futuristic";

const prompt = generatePrompt(Write a ${style} story about ${topic}.);

console.log(prompt); // Output: A futuristic story about space exploration.

2. Prompt Validation: javascript const { isValidPrompt } = require('banana-prompts');

const prompt1 = "Translate this sentence to French: Hello, world!"; const prompt2 = "";

console.log(Prompt 1 is valid: ${isValidPrompt(prompt1)}); // Output: Prompt 1 is valid: true console.log(Prompt 2 is valid: ${isValidPrompt(prompt2)}); // Output: Prompt 2 is valid: false

3. Prompt Formatting for Specific Models: javascript const { formatPrompt } = require('banana-prompts');

const basePrompt = "A detailed description of a cat."; const modelType = "stable-diffusion";

const formattedPrompt = formatPrompt(basePrompt, modelType);

console.log(formattedPrompt); // Output: A detailed description of a cat.

4. Building Complex Prompts with Template Literals: javascript const { generatePrompt } = require('banana-prompts');

const animal = "elephant"; const adjective = "majestic"; const environment = "African savanna";

const prompt = generatePrompt(Create a stunning image of a ${adjective} ${animal} in the ${environment}.);

console.log(prompt); // Output: Create a stunning image of a majestic elephant in the African savanna.

5. Implementing Prompt Control with Parameters: javascript const { generatePrompt } = require('banana-prompts');

function createPrompt(subject, mood, length) { return generatePrompt(Write a ${length} description of a ${subject} with a ${mood} mood.); }

const prompt = createPrompt("sunset", "melancholy", "short"); console.log(prompt); // Output: Write a short description of a sunset with a melancholy mood.

API Summary

  • generatePrompt(templateString, variables): Generates a prompt string by interpolating variables into a template string. Variables can be passed inline in template literals.
  • isValidPrompt(prompt): Validates a prompt to ensure it meets basic requirements (e.g., non-empty string). Returns a boolean.
  • formatPrompt(prompt, modelType): Formats a prompt for optimal performance with specific AI models. Currently supports basic formatting and expansion may be added in the future.
  • PromptError: A custom error class for handling prompt-related exceptions.

License

MIT

This package is part of the banana-prompts ecosystem. For advanced features and enterprise-grade tools, visit: https://bananaproai.com/banana-prompts/