Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
plurals enabled; search functionality massively improved
Browse files Browse the repository at this point in the history
  • Loading branch information
mapachurro committed Jul 22, 2024
1 parent 9ed7dd5 commit a11326a
Show file tree
Hide file tree
Showing 5 changed files with 4,025 additions and 0 deletions.
38 changes: 38 additions & 0 deletions data/sortterms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// This script is used to sort terms.json in alphabetical order.

const fs = require('fs');
const path = require('path');

const filePath = path.join(__dirname, 'terms.json');

// Read the JSON file
fs.readFile(filePath, 'utf8', (err, data) => {
if (err) {
console.error('Error reading the file:', err);
return;
}

// Parse the JSON data
let termsData = JSON.parse(data);

// Extract terms object
let terms = termsData[0].terms;

// Sort the terms alphabetically by the term key
let sortedTerms = Object.keys(terms).sort().reduce((acc, key) => {
acc[key] = terms[key];
return acc;
}, {});

// Update the terms data with the sorted terms
termsData[0].terms = sortedTerms;

// Write the sorted JSON back to the file
fs.writeFile(filePath, JSON.stringify(termsData, null, 2), 'utf8', (err) => {
if (err) {
console.error('Error writing the file:', err);
return;
}
console.log('Terms sorted and saved successfully.');
});
});
Loading

0 comments on commit a11326a

Please sign in to comment.