"horae" is a lightweight JavaScript library that provides methods to easily read JSON files and
manipulate data using the set
, get
, has
, and save
functions.
- Read JSON files effortlessly.
- Modify JSON data using
set
andget
methods. - Check if a specific property exists using
has
. - Save the updated JSON data back to the file.
You can install "horae" via npm:
npm install horae-configure
You can install "horae" via yarn:
yarn add horae-configure
You need to first prepare a JSON file in the outermost layer of the project
{
"position": {
"x": 1,
"y": 2
}
}
and then initialize horae
variable
const horae = new Horae<{
position: {
x: number;
y: number;
};
}>('config');
horae.get('position.x'); // 1
horae.get('position.y'); // 2
horae.has('position.x'); // true
horae.has('position.y'); // true
horae.has('position.z'); // false
horae.set('position.x', 100);
horae.get('position.x'); // 100
horae.set('position.', 100);
horae.save();
Go back and view the JSON file
{
"position": {
"x": 1000,
"y": 2
}
}