1.0.4 ā¢ Published 2 years ago
@joaopjt/xeon-js v1.0.4
Xeon.js
ā The chemistry table api done the right way.
Getting Started
Download the script file clicking here
OR
Install package via npm:
npm install @joaopjt/xeon-js
Creating instance
<script src="xeon-js.min.js"></script> // Import the downloaded script file
<script type="text/javascript">
console.log(Xeon.get(1).name); // Hydrogen
</script>
You can import the module with ES6 syntax too:
import Xeon from 'xeon-js';
Xeon.getByName('hydrogen'); // Return Hydrogen object.
API
.all()
The function all() returns all elements avaiable:
import Xeon from 'xeon-js';
Xeon.all(); // Array
.get()
The function return an periodic element object by its number passed as the first param:
import Xeon from 'xeon-js';
Xeon.get(1); // Hydrogen object
.getByName()
The function return an periodic element object by its name:
import Xeon from 'xeon-js';
Xeon.getByName('Oxygen'); // Oxygen object
.getByPhase()
The function return an periodic element array of objects by its phase ("Gas' or "Solid"):
import Xeon from 'xeon-js';
Xeon.getByPhase('Gas'); // Gas elements array.