Introduction
FLAMES.js is a browser-side JavaScript library for calculating FLAMES results from two names. It allows developers to create their own designs, forms and interactive experiences without writing the calculation logic from scratch.
You can use the library with a plain HTML page, CSS, JavaScript or a frontend framework that supports loading browser scripts. Your website controls the interface; FLAMES.js handles the calculation.
Important
This is a client-side JavaScript library, not a REST API. It runs in the visitor's browser after the script is loaded. It does not require an API key or a server request for each calculation.
Features
Simple function
Calculate a result by passing two names to one function.
Your own UI
Design your form, buttons, animations and result screen yourself.
Browser-based
Use it on websites that can load a regular JavaScript file.
No API key
No API key is needed for the documented browser-side function.
Installation
Add the FLAMES.js script to your HTML page. Place it before your own JavaScript code that uses the library.
Step 1: Include the library
<script src="https://flamescalculator.online/flames.js"></script>
This loads the script from the FLAMES Calculator website. The URL must remain publicly accessible for other websites to use it.
Step 2: Call the function
const result = FLAMES.calculate("Anurag", "Nandhana");
console.log(result);
The returned value is an object containing the result fields described below.
Basic Usage
Use FLAMES.calculate()
and provide two name strings.
const result = FLAMES.calculate("Anurag", "Nandhana");
console.log(result.letter);
console.log(result.result);
console.log(result.remainingCount);
| Parameter | Type | Description |
|---|---|---|
| name1 | String | First person's name. |
| name2 | String | Second person's name. |
Return Values
The function returns an object with three properties.
{
letter: "F",
result: "Friends",
remainingCount: 4
}
The values above illustrate the object structure only. Actual values depend on the supplied names and the library's algorithm.
letter
The FLAMES letter associated with the calculated result.
result
The text label corresponding to the result.
remainingCount
The remaining character count used by the calculation.
Code Examples
Example 1: Display the result
Create a simple form and show the calculated result on your page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My FLAMES App</title>
</head>
<body>
<h1>FLAMES Calculator</h1>
<input id="name1" type="text" placeholder="First name">
<input id="name2" type="text" placeholder="Second name">
<button id="calculateButton">Calculate</button>
<p id="output"></p>
<script src="https://flamescalculator.online/flames.js"></script>
<script>
document
.getElementById("calculateButton")
.addEventListener("click", function () {
const name1 = document.getElementById("name1").value;
const name2 = document.getElementById("name2").value;
const output = document.getElementById("output");
try {
const answer = FLAMES.calculate(name1, name2);
output.textContent =
"Result: " + answer.result +
" (" + answer.letter + ")";
} catch (error) {
output.textContent = error.message;
}
});
</script>
</body>
</html>
Example 2: Use your own design
You are not required to use a particular HTML layout or CSS framework. Build your own design and call the library when the visitor submits their names.
function getFlamesResult(firstName, secondName) {
return FLAMES.calculate(firstName, secondName);
}
// Use the returned object in your own UI.
const answer = getFlamesResult("Alex", "Sam");
document.querySelector("#result").textContent = answer.result;
Error Handling
Validate user input and handle errors before displaying a result. The library's documented implementation may throw an error if its input validation fails.
try {
const answer = FLAMES.calculate(
"Anurag",
"Nandhana"
);
console.log(answer.result);
} catch (error) {
console.error("Unable to calculate:", error.message);
}
Check the actual library implementation if you need to document the exact validation rules or error messages.
Privacy and Usage
The library is designed to perform the calculation in the browser. The documented function does not require a dedicated API request for each calculation.
Your website should explain its own data practices if it collects names or other information through additional scripts, analytics, forms or external services. Avoid collecting information that your website does not need.
For developers
The JavaScript file must be publicly accessible. Changes to the hosted file may affect websites that depend on it, so test updates before publishing them.
Frequently Asked Questions
Is FLAMES.js free to use?
Check the usage terms you publish for the library before using it in personal or commercial projects.
Do I need an API key?
No API key is needed for the client-side function shown in this documentation.
Can I design my own calculator?
Yes. You can create your own layout, colors, animations and result screen, then call FLAMES.calculate() from your JavaScript.
Is this a REST API?
No. It is a JavaScript library loaded into a browser. A REST API would require a server endpoint that accepts requests and returns data.
Where can I find the library?
Disclaimer
FLAMES is intended for entertainment purposes only. Its results do not scientifically determine relationship compatibility, personality or the future of a relationship.
Need Help?
For questions about this documentation or the FLAMES Calculator website, contact:
heycoders.anurag@gmail.com