! This library is still in alpha phase, please be careful with version changes and using it in production projects
SVG Values Calculator
A simple npm package to calculate values from SVG files.
Installation
npm install @xilerth/svg-splitter
Usage
const svgValuesCalculator = require("@xilerth/svg-splitter");
// Calculate values from SVG file
const filePath = "path/to/your/svg/file.svg";
const result = svgValuesCalculator.calculateValuesFromSVGFile(filePath);
console.log(result);
// Calculate values from SVG content
const svgContent = '<svg>...</svg>';
const resultContent = svgValuesCalculator.calculateValuesFromSVGFileContent(svgContent);
console.log(resultContent);
Functions
calculateValuesFromSVGFile(filePath)
Calculates values from an SVG file.
- filePath: Path to the SVG file.
const result = svgValuesCalculator.calculateValuesFromSVGFile("path/to/your/svg/file.svg");
console.log(result);
calculateValuesFromSVGFileContent(svgContent)
Calculates values from SVG content.
- svgContent: SVG content as a string.
const result = svgValuesCalculator.calculateValuesFromSVGFileContent(svgContent);
console.log(result);
Example
const svgValuesCalculator = require("svg-values-calculator");
// Example SVG content
const svgContent = `
<svg>
<path id="path1" d="M10 10 L20 20" fill="#ff0000"/>
<path id="path2" d="M30 30 L40 40" fill="#00ff00"/>
</svg>
`;
// Calculate values
const result = svgValuesCalculator.calculateValuesFromSVGFileContent(svgContent);
console.log(result);
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Changelog
0.0.7:
Now each level will appear between "~" in the full name and will still be separated by "_"