README for ASPAVA JavaScript Library
Overview
The ASPAVA
is a versatile JavaScript library designed to manipulate and
generate sequences of words or phrases. It is a flexible and easy-to-use tool
that can be particularly useful for various applications, such as text
processing, generative art, and educational purposes.
This library is built around a simple yet powerful class, AspavaGenerator
,
which provides various methods for manipulating a list of words or phrases. By
default, it comes with a predefined list of words, but it can be easily
customized to suit your needs.
Features
- Customizable Word List: Start with a default set of words or input your
own list.
- Various Manipulation Methods: Includes methods for shuffling, sorting
(ascending and descending), changing case, and more.
- Generator Function: Utilize a generator function for iterative word
generation.
- Easy to Integrate: Designed as an ES6 module, making it straightforward to
include in modern JavaScript projects.
Installation
To use the ASPAVA
in your project, simply include it as a module. Ensure that
you have a JavaScript environment that supports ES6 modules.
import aspava from "npm:aspava";
Usage
Initialization
Create an instance of AspavaGenerator
with the default word list, or provide
your own array of words.
import { AspavaGenerator } from "npm:aspava";
const customWords = ["Word1", "Word2", "Word3"];
const aspava = new AspavaGenerator(customWords);
Basic Methods
-
Get a specific word:
const word = aspava.get(2);
-
Get all words:
const words = aspava.getAll();
-
Get words as a string:
const str = aspava.getAsString();
-
Get first letters of each word:
const initials = aspava.getFirstLetters();
Manipulation Methods
-
Shuffle the words:
aspava.shuffle();
-
Sort words in ascending order:
aspava.ascending();
-
Sort words in descending order:
aspava.descending();
-
Convert words to uppercase:
aspava.upper();
-
Convert words to lowercase:
aspava.lower();
Using the Generator
The generator()
method yields a sequence of words up to a specified maximum
generation count (default is 6).
for (const word of aspava.generator(6)) {
console.log(word);
}
Example
Here is a complete example demonstrating various functionalities of the
ASPAVA
:
import aspava from "npm:aspava";
for (const word of aspava.shuffle().upper().generator(100)) {
console.log(word);
}
Conclusion
The ASPAVA
is a powerful and flexible tool that can be a valuable addition to
various JavaScript projects. With its easy-to-use interface and a wide range of
functionalities, it opens up many possibilities for creative and practical
applications.
Note: This README.md covers the basic functionalities and usage of the
ASPAVA
library. For more advanced use cases and customization, please ask for
detailed information on GitHub.