New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mathcheck

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mathcheck

Validate math expressions in JavaScript and TypeScript. Fast, lightweight, and accurate.

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

npm version Build Status License Downloads

MathCheck

MathCheck is a lightweight library for validating, simplifying, and converting mathematical expressions to LaTeX, written in TypeScript. It's perfect for educational apps, scientific tools, and financial applications that require accurate mathematical computations and formatting.

✨ Why Use MathCheck?

  • 🚀 Lightweight and Fast: Optimized for performance in real-world applications.
  • 🛠️ TypeScript First: Fully typed for better developer experience and type safety.
  • 🔍 Accurate Validation: Detects syntax errors, unbalanced parentheses, and invalid characters.
  • Simplification: Automatically simplifies valid mathematical expressions.
  • 📄 LaTeX Conversion: Converts mathematical expressions into properly formatted LaTeX.

📦 Installation

You can install MathCheck using npm or yarn:

npm install mathcheck

or

yarn add mathcheck

🛠️ Usage

Importing

import {
  validateExpression,
  simplifyExpression,
  convertToLatex,
} from "mathcheck";

Validating Mathematical Expressions

const validation = validateExpression("(2 + 3) * 5");
console.log(validation); // { isValid: true }

Simplifying Expressions

const simplified = simplifyExpression("2 + 3 * 5");
console.log(simplified); // { success: true, result: 17 }

Converting to LaTeX

const latex = convertToLatex("(2 + 3) * 5");
console.log(latex); // { success: true, latex: '\\left(2 + 3\\right) \\cdot 5' }

📜 API

validateExpression(expression: MathExpression): ValidationResult
simplifyExpression(expression: MathExpression): SimplificationResult
convertToLatex(expression: MathExpression): LatexConversionResult

Types

  • ValidationResult: { isValid: boolean, error?: string }
  • SimplificationResult: { success: boolean, result?: number, error?: string }
  • LatexConversionResult: { success: boolean, latex?: string, error?: string }

🔒 Requirements

  • Node.js version 14.0.0 or higher.

🛡️ License

This project is licensed under the MIT License. See the LICENSE file for more information.

👨‍💻 Contribution

Feel free to open issues or submit pull requests to improve MathCheck. All contributions are welcome! 🌟

  • Fork the repository.
  • Create a branch for your feature: git checkout -b my-feature.
  • Make your changes and commit: git commit -m 'Add my awesome feature'.
  • Push to the repository: git push origin my-feature.
  • Open a pull request on GitHub.

💡 Author

Created by Kledenai. me@kledenai.com.

Keywords

math

FAQs

Package last updated on 19 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts