0.0.1 • Published 1 year ago
shuffle-edm v0.0.1
shuffle-edm
shuffle-edm
is a Node.js utility for processing text files, designed to facilitate tasks such as converting text to JSON, shuffling data, and converting shuffled data back to text. This utility is particularly useful for scenarios like manipulating quiz questions or randomizing content.
Installation
To use shuffle-edm
in your Node.js project, you can install it via npm:
npm install shuffle-edm
## 2. Usage
Create a JavaScript file (e.g., `example.js`) and use the following code snippet to demonstrate the usage:
```javascript
const { txt2json, shuffle, convert2txt } = require('shuffle-edm');
// Usage example
const filePath = 'demo.txt';
// Convert text to JSON
txt2json(filePath)
.then(questions => {
// Shuffle questions and options
const shuffledData = shuffle(questions);
// Convert shuffled data back to text
convert2txt(shuffledData, "bot.txt");
})
.catch(err => {
console.error('Error processing data:', err);
});
0.0.1
1 year ago