{"_id":"@alexnogueira4/html-to-object-parser","name":"@alexnogueira4/html-to-object-parser","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@alexnogueira4/html-to-object-parser","version":"1.0.0","main":"parser.js","description":"A simple HTML parser that converts HTML into a JavaScript object format.","author":{"name":"Alexsander Nogueira","email":"alexnogueira4@gmail.com"},"license":"MIT","scripts":{"test":"jest","start":"node server.js"},"dependencies":{"jsdom":"25.0.1"},"devDependencies":{"jest":"29.7.0"},"publishConfig":{"access":"public"},"_id":"@alexnogueira4/html-to-object-parser@1.0.0","gitHead":"a394cc48698466ad997e47c6ff19c977ff260919","_nodeVersion":"23.1.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-W0tZtkYMZlG87GX8VzEBVzS7J4rBOsT1WmfFMjKr100Dws6I+kIjycxvLlpYemMfUd+G66wVGHy2dJRNGBf59A==","shasum":"57bc9a2691a7f6a956848c1100dba3e852eaaf1e","tarball":"https://registry.npmjs.org/@alexnogueira4/html-to-object-parser/-/html-to-object-parser-1.0.0.tgz","fileCount":6,"unpackedSize":7222,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFR5B8iX1RX432UO/UvRBKkXwfRrzlVy4abRuD/MQsgtAiEA9hGqk+4qjPiUeqVN+MmzxOioTQ49B3f3FjE011ScAyU="}]},"_npmUser":{"name":"alexnogueira4","email":"alexnogueira4@gmail.com"},"directories":{},"maintainers":[{"name":"alexnogueira4","email":"alexnogueira4@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-to-object-parser_1.0.0_1732147693427_0.045707164758640895"},"_hasShrinkwrap":false}},"time":{"created":"2024-11-21T00:08:13.324Z","1.0.0":"2024-11-21T00:08:13.634Z","modified":"2024-11-21T00:08:13.918Z"},"maintainers":[{"name":"alexnogueira4","email":"alexnogueira4@gmail.com"}],"description":"A simple HTML parser that converts HTML into a JavaScript object format.","author":{"name":"Alexsander Nogueira","email":"alexnogueira4@gmail.com"},"license":"MIT","readme":"# HTML Parser\n\nThis project is a simple HTML parser that converts HTML into a JavaScript object format. It can be run both in the browser and in Node.js, and it includes automated tests using Jest.\n\n## Features\n\n- **HTML to Object Conversion**: Converts simple HTML into a JavaScript object structure.\n- **Cross-Environment**: Works in both the browser and Node.js environments.\n- **Testing**: Includes unit tests with Jest to ensure the functionality of the code.\n\n## Project Structure\n## Project Structure\n\n```\nhtml-parser/\n├── __tests__/\n│   └── parser.test.js      # Unit tests for the parser\n├── parser.js               # Main implementation of the parser\n├── server.js               # Code to run the parser in Node.js\n├── package.json            # npm configuration, dependencies, and scripts\n└── index.html              # User interface to run in the browser\n```\n\n## How to Run the Project\n\n### 1. Running in the Browser\n\nTo run the application in the browser, you can use a simple HTTP server like `http-server`.\n\n#### Steps:\n\n1. **Install `http-server`**:\n\n   If you don't have `http-server` installed, you can install it globally via npm:\n\n   ```\n   npm install -g http-server\n   ```\n\n2. **Start the Server**:\n\n    In the project directory, run the following command:\n\n    ```\n    http-server\n    ```\n\n    This will start a server on port 8080 by default. You can now open your browser and access the app at http://localhost:8080.\n\n3. **Test the Application**:\n\n    Open the index.html file in the browser.\n    Enter HTML in the textarea and click \"Convert\" to see the result converted to JSON.\n\n### 2. Running in Node.js\nIf you prefer to run the project in Node.js, you can use the server.js script, which reads an HTML file, processes it using the parser, and prints the result to the console.\n\n#### Steps:\n1. **Install Dependencies**:\n\n    In the project directory, install the dependencies by running:\n\n    ```\n    npm install\n    ```\n2. **Run the Script in Node.js**:\n\n    To run the script, pass the path to an HTML file as an argument:\n\n    ```\n    node server.js path/to/file.html\n    ```\n    The script will read the content of the HTML file, process it, and print the converted result in JSON format to the console.\n\n### 3. Running Tests\nThe project includes unit tests to ensure the code works correctly. The tests are written using Jest.\n\n#### Steps:\n1. **Install Test Dependencies**:\n    If you haven't installed the test dependencies, run:\n\n    ```\n    npm install --save-dev jest\n    ```\n\n2. **Run the Tests**:\n\n    To run the tests, use the following command:\n    ```\n    npm test\n    ```\n    This will run all tests in the __tests__/ directory and display the results in the console.\n\n### 4. Scripts in package.json\nYour package.json should include useful scripts to run tests and the server. Here's an example of what the package.json file should look like:\n\n```\n{\n  \"name\": \"html-parser\",\n  \"version\": \"1.0.0\",\n  \"main\": \"parser.js\",\n  \"scripts\": {\n    \"test\": \"jest\",\n    \"start\": \"http-server\"\n  },\n  \"devDependencies\": {\n    \"jest\": \"^27.0.0\"\n  }\n}\n```\n- ***npm test***: Runs the Jest tests.\n- ***npm start***: Starts the HTTP server using http-server.\n\n### 5. Dependencies\n- ***jsdom***: Required for parsing HTML in Node.js.\n- ***jest***: Used for unit testing.\n\nTo install all the dependencies, run:\n```\nnpm install\n```","readmeFilename":"README.md"}