Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jesselpalmer/discrete-math
Discrete Mathematics library
https://github.com/jesselpalmer/discrete-math
discrete-math discrete-mathematics
Last synced: 11 days ago
JSON representation
Discrete Mathematics library
- Host: GitHub
- URL: https://github.com/jesselpalmer/discrete-math
- Owner: jesselpalmer
- License: mit
- Created: 2023-08-27T03:09:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-29T18:30:28.000Z (about 1 year ago)
- Last Synced: 2024-04-14T12:57:30.529Z (7 months ago)
- Topics: discrete-math, discrete-mathematics
- Language: JavaScript
- Homepage:
- Size: 132 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/dw/discrete-math.svg)](https://www.npmjs.com/package/discrete-math) [![Node.js CI](https://github.com/jesselpalmer/discrete-math/actions/workflows/nodejs-ci.yml/badge.svg)](https://github.com/jesselpalmer/discrete-math/actions/workflows/nodejs-ci.yml/)
# discrete-math
A JavaScript library focused on providing functions and utilities for discrete mathematics operations.
## Installation
To install discrete-math, use npm:
```bash
npm install discrete-math
```## Usage
```bash
import { difference } from 'discrete-math/set';
```### Set
This module provides functions for set operations.
### difference(setA, setB)
Returns the difference between two sets or arrays. The difference is the set of elements that belong to setA but not to setB.
**Parameters**:
- **setA (Set|Array)**: The first set or array.
- **setB (Set|Array)**: The second set or array, from which elements will be subtracted.**Return**: A new set containing elements that are in 'setA' but not in 'setB'.
**Example**:
```javascript
const setA = [1, 2, 3];
const setB = [1, 3];console.log(difference(setA, setB)); // Outputs: Set { 2 }
```## Contribute
Contributions are always welcome! Please ensure that you adhere to the established coding standards and provide tests for any new or changed functionality.
If you find any bugs or have a feature request, please open an issue on [GitHub](https://github.com/jesselpalmer/discrete-math).