-
Notifications
You must be signed in to change notification settings - Fork 2
main_doc
Function | Description |
---|---|
toFancytext(text:string) |
converts text parameter input into ascii characters that look 'fancy'. |
toFliptext(text: string) |
turns text parameter input upside-down. Returns null if a blank string or null character is passed as the parameter. |
toFliptextTable(text:string) |
similar to toFliptext but adds a flip-table asciimoticon beside the text. |
toWitchtext(text:string) |
converts text parameter input into ascii characters that look 'witch-like'. |
toCrazytext(text:string) |
convert text parameter input into ascii characters that look 'crazy'. |
toBubbletext(text:string) |
converts text parameter input into ascii characters surrounded by 'bubbles'. |
toArcanetext(text:string) |
converts text parameter input into ascii characters that look 'arcane'. |
Function | Description |
---|---|
dice(amount:number) |
Retrieves a die with circles specified by the amount parameter. amount must be within 1 - 6 |
randomDice() |
Retrieves a random die. |
loading(percent:number) |
Creates a loading bar that contains a shaded section which symbolises the percent parameter passed. |
dollarbill(amount:number) |
Creates a dollar bill that has the value of the amount parameter passed. |
This is a map which contains the asciimoticon and the words associated with it.
const faces = core.faces;
for (var faceName in faces) {
const face = faces[faceName];
console.log(`|${face.ascii} | ${face.words} |`); // TOO MANY TO DEFINE
}
Each object in the map contains words
and ascii
properties. To retrieve a specific face, simply access it by passing the name of the asciimoticon into the map. Here's a list of all available faces.
This is a map which contains the asciimoticon and the words associated with it. This is similar to the faces module, but it consists of symbols only.
const symbols = core.symbols;
for (var name in symbols) {
const symbol = symbols[name];
console.log(`|${symbol.ascii} | ${symbol.words} |`); // TOO MANY TO DEFINE
}
This is a map which contains themes mapped to arrays of asciimoticons related to that theme.
const themes = core.themes;
for(var theme in themes){
const faces = themes[theme]; // array object
console.log(faces); // TOO MANY TO DEFINE
}
Contains ascii components for specific parts.
const parts = core.parts;
// Load different array of parts
const eyes = parts.eyes;
const cheeks = parts.cheeks;
const mouth = parts.mouth;
const face = parts.face;
const arms = parts.arms;
const wings = parts.wings;
const other = parts.other;
const weapon = parts.weapon;
Function | Description |
---|---|
template() |
creates a new template object. Always use this if you want user define mappings. |
textTemplate(keyword:string, table:object, backwards?:boolean) |
Creates a template used for replacing characters using the custom key-value table mapping |
parse(text:string, options?:object, template?:object) |
parses the text and converts delimited words with asciimoticons |
build(sequence: string[], template: object) |
Builds an asciimoticon using the sequence and the custom mapping |
createReversedTable(baseString?:string) |
Creates a table that maps the alphabet to its reversed equivalent. If a parameter is passed, it ensures that all the characters in the string are unique and then maps the value to the character at the opposite end of the string. |
createBinaryTable(baseString:string) |
Creates a table which maps the characters of the base string to its binary equivalent. This function ensures that all the characters in the string are unique and then creates a mapping using the unique characters. |
Both textTemplate
and template
functions create an object that supports these functions. You can retrieve its values by using the content
property.
Function | Description |
---|---|
map(key:string, value:string |
Inserts the key-value pairs into the content |
delete(key:string) |
Deletes the value with the key |
merge(templates:object[]) |
Creates a new template with combined values of all the templates passed. The merge only includes key-value pairs that do not exist in the current template you are calling the function from. |
This functionality should be used in conjunction with core.parts
module.
const template = builder.template();
template.map('key1', 'value1');
template.map('key2', 'value2');
console.log(template.content); // {key1: 'value1', key2: 'value2'}
const template = builder.template();
template.map('key1', 'value1');
template.map('key2', 'value2');
template.delete('key1'); // deletes key1 property
console.log(template.content); // {key2: 'value2'}
const template = builder.template();
template.map('key1', 'value1');
template.map('key1', 'value2'); //overwrite key1 inside the template
console.log(template.content); // {key1: 'value2'}
// create text template and normal template
const table = builder.createReversedTable();
const textTemplate = builder.textTemplate('reversed', table); // { reversed: function(string) }
const template1 = builder.template();
template1.map('key1', 'value1'); // { key1: 'value1' }
const template2 = builder.template();
template2.map('key1', 'value2');
template2.map('key2', 'value3');
// merge two templates
const mergedTemplate = template.merge([textTemplate, template2]);
console.log(mergedTemplate.content);
// {
// key1: 'value1',
// key2: 'value3',
// reversed: function(string)
// }
// This one is used if you want a custom text module
const template = builder.template();
template.map('customtext', (text) => { //do stuff here });
// If you pass this into the parse function, you can use it by calling (customtext,value)
const input = '(bear)';
const output = builder.parse(input);
console.log(output); // ʕ·͡ᴥ·ʔ
const input = '(fliptext,abcdefghijklmnopqrstuvwxyz)';
const output = builder.parse(input);
console.log(output); //zʎxʍʌnʇsɹbdouɯןʞɾıɥƃɟǝpɔqɐ
const options = {
prefix: ':',
suffix: ':'
};
const input = ':bear:';
const output = builder.parse(input, options);
console.log(output); // ʕ·͡ᴥ·ʔ
// define template mapping
const template = builder.template();
template.map('custom', '(o____O)');
const input = '(custom)';
const output = builder.parse(input, null, template);
console.log(output) //(o____O)
const template = builder.template();
template.map('customtext', (text) => { //do stuff here });
const input = '(customtext,some values here)';
const output = builder.parse(input, null, template);
console.log(output); //customtext output
const template = builder.template();
template.map('eL', 'o');
template.map('eR', 'o');
template.map('fL', '(');
template.map('fR', ')');
template.map('m', '_');
const sequence = ['fL', 'eL', 'm', 'eR', 'fR'];
const output = builder.build(sequence, template);
console.log(output); //(o_o)
Function | Description |
---|---|
transpose(str:string, table:object, backwards:boolean) |
Creates a new string from the table. If the backwards flag is set to true, it returns the new string backwards |
find(partial:string) |
Finds all the faces related to the partial string |